Home    |    Concepts   |   API   |   Samples
Concepts > XML > API Entities
XML Doc

An XML document is a hierarchically structured text document consisting of labels (called tags) and data. The XML doc entity is used as a placeholder for XML documents that are stored into or retrieved from the database by ArcSDE.

The ArcSDE API uses the XML Document object (SeXmlDoc in Java, SE_xml_doc*  functions in C) to store and retrieve an XML document from ArcSDE. ArcSDE Insert and Query stream objects communicate with the XML Document object, which in turn is associated with the XML column.

Storage

In ArcSDE, an XML document is always stored in a BLOB and can be stored in compressed or uncompressed form. By default, the document is stored in compressed form. This can be changed by using the XML_DOC_UNCOMPRESSED_TYPE DBTUNE parameter.

The XML_DOC_UNCOMPRESSED_TYPE has three possible values:

  • Binary—This is the default setting. The XML Document is stored in a DBMS BLOB (LOB in Oracle, IMAGE in SQL Server) column. This type must be used if the user is storing documents that are a mix of codepages or that do not match their client locale or their database locale. By storing the doc in a binary column, there are no codepage conversion issues and all docs will be stored safely.

  • Text—The doc is stored in a DBMS long text column (CLOB in Oracle, TEXT in SQL Server). This type can be used if the user’s locale and the encoding for all XML docs that will be stored match exactly, and this codepage is an ANSI (not Unicode) codepage. Also, the codepage must be supported by the underlying database text type. Any deviation from this will result either in an error or garbage characters being stored.
    For example, if a UNIX client in an eastern European codepage (ISO8859-2 on UNIX) tries to store data on a Windows server that is also eastern European (WIN1250 on Windows), this will work provided the XML document is encoded in the client codepage (ISO8859-2) not the server codepage (WIN1250). Even though both are the same language, they are different encodings. In the above example, the NLS_LANG environment variable will tell the DBMS to convert from ISO8859-2 to WIN1250 (assuming that the database was also setup in WIN1250).

  • Unicode—The doc will be stored in a DBMS long Unicode column (Oracle NCLOB, SQL Server NTEXT). The restrictions on the use of this column are the same as TEXT, but for Unicode codepages, not ANSI. However, with Unicode it does not matter what the database’s codepage is since anything can be converted to the underlying Unicode column. But the client locale and xml document must still match exactly.

The following code snippets show how an XML Doc object is used to store and retrieve an XML document.

Top

feedback | privacy | legal