This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > ENSLIB namespace > EnsLib.EDI.XML.Document

EnsLib.EDI.XML.Document

persistent class EnsLib.EDI.XML.Document extends %Library.Persistent, EnsLib.EDI.XML.Prop, %XML.SAX.EntityResolver, %XML.Adaptor

SQL Table Name: EnsLib_EDI_XML.Document

This class encapsulates an XML document stream and provides methods to interrogate and update it Two types of path strings can be used to identify a document node: a 'Property path' that is based in a particular XML schema definition (xsd), irrespective of any particular document instance, and a 'DOM path' that is based in the structure of a particular document irrespective of any XML schema. The DOM Path uses XPATH conventions; it always starts with '/' while a Property Path never does.

Property Inventory (Including Private)

Method Inventory (Including Private)

Parameters

parameter DEFSEARCHCLASS = EnsLib.EDI.XML.SearchTable;
Name of the default SearchTable indexing class used in UI choices and MessageBank submissions
parameter DOCCLASSFULLNAME = XML Virtual Document;
Inherited description: Full descriptive name for this subclass of document
parameter DOCCLASSNAME = XML Document;
Inherited description: Compact descriptive name for this subclass of document
parameter DOCSHORTNAME = XML;
parameter SCHEMACLASS = EnsLib.EDI.XML.Schema:DS;
Name of the associated schema class and, after a colon, the schema class code that represents a DocType

Properties (Including Private)

property Identifier as %String) [ Calculated , Transient , ReadOnly ];
Inherited description: Unique document identification string found in document content (none defined for a general XML document)
Property methods: IdentifierCompute(), IdentifierDisplayToLogical(), IdentifierGet(), IdentifierIsValid(), IdentifierLogicalToDisplay(), IdentifierLogicalToOdbc(), IdentifierNormalize(), IdentifierSQLCompute()
property Name as %String) [ Calculated , Transient , ReadOnly ];
Inherited description: Raw type name of document as declared in document content
Property methods: NameCompute(), NameDisplayToLogical(), NameGet(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize(), NameSQLCompute()
property RawContent as %String (MAXLEN = 10000) [ Calculated , Transient , ReadOnly ];
The raw text content of the document. Note that this is a truncated version suitable for use in SQL results and visual inspection, but not a complete or definitive representation of the document.
Property methods: RawContentCompute(), RawContentDisplayToLogical(), RawContentGet(), RawContentIsValid(), RawContentLogicalToDisplay(), RawContentLogicalToOdbc(), RawContentNormalize(), RawContentSQLCompute()
property TypeVersion as %String) [ Calculated , Transient , ReadOnly ];
Inherited description: Raw type version of document if declared in document content
Property methods: TypeVersionCompute(), TypeVersionDisplayToLogical(), TypeVersionGet(), TypeVersionIsValid(), TypeVersionLogicalToDisplay(), TypeVersionLogicalToOdbc(), TypeVersionNormalize(), TypeVersionSQLCompute()

Methods (Including Private)

private method %OnAddToSaveSet(depth As %Integer = 3, insert As %Integer = 0, callcount As %Integer = 0) as %Status
Inherited description: This callback method is invoked when the current object is added to the SaveSet, either because %Save() was invoked on this object or on an object that references this object. %OnAddToSaveSet can modify the current object. It can also add other objects to the current SaveSet by invoking %AddToSaveSet or remove objects by calling %RemoveFromSaveSet.

If this method returns an error status then %Save() will fail and the transaction will be rolled back.

private method %OnAfterSave(insert As %Boolean) as %Status
%Save() calls this method internally. As a result %Save() saves a copy of the cache arrays to storage but keeps them in memory as well for further changes.
private method %OnClose() as %Status
Inherited description: This callback method is invoked by the %Close() method to provide notification that the current object is being closed.

The return value of this method is ignored.

private method %OnConstructClone(object As %RegisteredObject, deep As %Boolean = 0, ByRef cloned As %String) as %Status
Inherited description: This callback method is invoked by the %ConstructClone() method to provide notification that a clone of an object is being created. It passes in the oref of the object that was cloned in object.

If this method returns an error then the object will not be created.

private classmethod %OnDelete(oid As %ObjectIdentity) as %Status
Inherited description: This callback method is invoked by the %Delete() method to provide notification that the object specified by oid is being deleted.

If this method returns an error then the object will not be deleted.

private method %OnNew(initvalue As %CacheString = $$$NULLOREF) as %Status
create an object based on id=initvalue but editable
private method %OnOpen() as %Status
Inherited description: This callback method is invoked by the %Open() method to provide notification that the object specified by oid is being opened.

If this method returns an error then the object will not be opened.

method CommittedMode(pMode As %Boolean = 1) as %Status
Switch from keeping changes in memory to keeping them in storage. Allows for unlimited changes to a document without running out of memory. This mode is automatically in effect when the object is created by loading from a stored Id
method CopyValues(pSource As EnsLib.EDI.XML.Document, pSourcePath As %String, pTargetPath As %String, pAction As %String, pKey As %String, pEmptyFieldAsNull As %Boolean = 0, pIgnoreMissingSource As %Boolean = 0) as %Status
Inherited description: Copy a whole set of values from source to target when iteration is implied between 2 VDocs pSourcePath contains the property path to the source set
pTargetPath contains the property path to the target set
pAction contains an action code: "set", etc..
pKey contains an optional key value or a set of comma-separated key values to be used as array indices where empty array index placeholders are present in pPropertyPath.
method DumpMaps(pWhich As %String = "") as %Status
classmethod EnumerateDocTypesClose(ByRef qHandle As %Binary) as %Status
classmethod EnumerateDocTypesExecute(ByRef qHandle As %Binary, Category As %String, IncludeBase As %Boolean) as %Status
classmethod EnumerateDocTypesFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer) as %Status
classmethod EnumerateTypeCategoriesClose(ByRef qHandle As %Binary) as %Status
classmethod EnumerateTypeCategoriesExecute(ByRef qHandle As %Binary, Standard As %String = "") as %Status
classmethod EnumerateTypeCategoriesFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer) as %Status
classmethod GetContentArray(Output pContents, pMode As %String, pDocType As %String, pLevel As %Integer, pIncludeBase As %Boolean, pElem, pNodeAddr) as %Status
Inherited description: Returns array of properties that make up the contents of this object.
This method in implemented within the document class.
The content array is in the form:
pContents(n,"type")="%String"
pContents(n,"name")="Field"
pContents(n,"alias")=alias code
If pContents(n) is non-zero then the property is a composite type with
sub-properties. The sub-properties are indexed with a similar structure under
pContents(n,m) where m is the index of the subtype property.
method GetSubDocumentAt(pPropertyPath As %String = "", Output pStatus As %Status) as EnsLib.EDI.XML.Document

Retrieve an XML virtual document constructed from the tree identified by pPropertyPath. This path may be either a "DOM Path" or a "Property Path". The Document instance is created using the supplied pPropertyPath as the root of the tree -- this is equivalent to calling the GetValueAt()() with the "f" format flag specified.

A "DOM Path" is schema independent and starts from the document root with a '/' character and is delimited by the '/' character at each level of descent, and by square brackets '[' and ']' for repeating elements.

A "Property Path" is based on a simplified projection of the XML schema applied to the current document by way of its DocType property. It starts from the root element (one level down from the XML document root) and is delimited by the "." character and by parentheses '(' and ')' for repeating elements.

method GetValueAt(pPropertyPath As %String = "", pFormat As %String, Output pStatus As %Status) as %String
Retrieve the content value of the XML element or attribute identified by pPropertyPath. This path may be either a "DOM Path" or a "Property Path".

A DOM path is schema independent and starts from the document root with a '/' character and is delimited by the '/' character at each level of descent, and by square brackets '[' and ']' for repeating elements.

A Property path is based on a simplified projection of the XML schema applied to the current document by way of its DocType property. It starts from the root element (one level down from the XML document root) and is delimited by the "." character and by parentheses '(' and ')' for repeating elements.

The pFormat argument is an optional string comprised of a collection of single-character flag codes:

  • 1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
  • a : attributes alphabetical
  • c : canonical ; ignores 'eintw'
  • e : close elements even when empty
  • f : full top element not just its contents
  • i : indent with 4 spaces unless 't' or 1-9
  • l : output schema information, schema uri and schema location, based on property stored in ..schemaLocation
  • n : newline (lf) after every text-free element
  • o : output unescaped - for instance don't change < to &lt;
  • p : suppress output of namespace prefixes
  • q : use double quotes to set off attribute values if possible
  • s : use stored indentation whitespace (ignores 'it1-9')
  • r : use stored returns / newlines (ignores 'nw')
  • t : indent with tab
  • u : declare prefixes as well as using them
  • w : Windows-style cr/lf newline after every text-free element
  • x : omit namespaces in output
method GetValues(pPropertyPath As %String = "", pFormat As %String, pValSepString As %String = "<>", Output pStatus As %Status) as %String
Finds all values matching a PropertyPath string that contains zero or more () implicit iterators Supports PropertyPath values with (), (n) to choose a specific one of the given type, or just plain (same as path().
method GetValuesArray(pPropertyPath As %String, pFormat As %String, ByRef pArray As %String, Output pStatus As %Status, ByRef pLongArray As %String)
method IdentifierGet() as %String
classmethod ImportFromDevice(Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document
classmethod ImportFromFile(pFilename As %String, pDocNum As %Integer = 1, Output pStatus As %Status, pConfigItem As %String) as EnsLib.EDI.XML.Document
classmethod ImportFromIOStream(pIOStream As %IO.I.CharacterStream, Output pStatus As %Status = $$$OK, ByRef pConfigItem As %String = "") as EnsLib.EDI.XML.Document
classmethod ImportFromLibraryStream(pLibStream As %Stream.Object, Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document
classmethod ImportFromString(pString As %String, Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document
classmethod KillGlobals(Output pDeletedCount, pKeepExtentCount=0, pDisplayLog=1)
method NameGet() as %String
method OutputHTMLZen() as %Status
Display Document as HTML
method OutputToDevice(pFormat As %String) as %Status
method OutputToFile(pFilename As %String, pOverwrite As %Boolean, pFormat As %String) as %Status
method OutputToIOStream(pIOStream As %IO.I.CharacterStream, pFormat As %String, pFlush As %Boolean = 1) as %Status
If pFormat contains a string of the form: C(encoding) then an XML charset declaration line will be output. If encoding is empty the IOStream's encoding will be used. If encoding starts with ! then the IOStream's encoding will be set to the given encoding.
method OutputToLibraryStream(pLibStream As %Stream.Object, pFormat As %String) as %Status
method OutputToString(pFormat As %String, Output pStatus As %Status) as %String
classmethod Purge(Output pDeletedCount As %Integer, pDaysToKeep As %Integer = 7, pDummy As %Boolean = 0) as %Status
method RawContentGet() as %String
method SetMaxCalcCache(size As %Integer)
method SetSubDocumentAt(pSubDocument As EnsLib.EDI.XML.Document = "", pPropertyPath As %String = "") as %Status
Insert the XML representation of pSubDocument into this document at the path specified by pPropertyPath.
method SetValueAt(pValue As %String = "", pPropertyPath As %String = "", pAction As %String = "set", pKey As %String = "") as %Status
Inherited description: Set the value of the designated virtual property.
pValue contains the value to set.
pPropertyPath contains a text expression representing the address within the document of the value of interest.
pKey contains an optional key value or a set of comma-separated key values to be used as array indices where empty array index placeholders are present in pPropertyPath.
pAction contains an action code: "set", "clear", "append", etc.
classmethod TotalCount() as %Integer
method TypeVersionGet() as %String
Inherited description: Subclasses should override this if the version can be gotten from the document content
method Validate(pValidationSpec As %String = "", pSSLConfig As %String = "", pHttpTimeout As %Numeric = "") as %Status
Validates the XML VDoc against the schema that is referenced in its DocType property. If the schema URL specifies https then you must provide an SSL configuration name in pSSLConfig that will work with the URL target server.

Queries

query EnumerateDocTypes(Category As %String = "", IncludeBase As %Boolean = 0)
Selects Type As %String
Returns a list of available DocTypes for this document class.
The DocType is returned as the first column in the result set.
The Category parameter can be used to restrict the list.
If Category is:
0 - return only DocTypes in standard categories
+ - return only DocTypes in user-defined categories
empty - return DocTypes from all categories
a category name - return only DocTypes in the named category
a partial name suffixed with '%' - return only DocTypes in categories matching the partial category name
other - return nothing
If IncludeBase is:
0 - return only DocTypes defined in the current schema category itself
1 - return all DocTypes in the current schema category's base category in addition to those defined in the current category itself
query EnumerateTypeCategories(Standard As %String = "")
Selects Category As %String, Description As %String, IsStandard As %Boolean, Base As %String
Returns a list of document type schema categories for the document class.
The Standard parameter can be used to restrict the list.
If Standard is: 0 - return only standard categories + - return only user-defined categories empty - return all categories a category name - return only the named category a partial name suffixed with '%' - return only categories matching the partial category name other - return nothing

Indexes

index (OriginalDocId on OriginalDocId);
Index methods: OriginalDocIdDisplayToLogical(), OriginalDocIdExists(), OriginalDocIdGet(), OriginalDocIdGetStored(), OriginalDocIdIsValid(), OriginalDocIdLogicalToDisplay(), OriginalDocIdLogicalToOdbc(), OriginalDocIdNormalize(), OriginalDocIdSet()

Triggers

trigger OnDelete (BEFORE event DELETE);

Inherited Members

Inherited Properties (Including Private)

Inherited Methods (Including Private)

Storage

Storage Model: CacheStorage (EnsLib.EDI.XML.Document)

^EnsLib.EDI.XML.DocumentD(ID)
=
%%CLASSNAME
%storedContentRef
DocType
TimeCreated
Source
IsMutable
OriginalDocId

Storage Model: CacheStorage (EnsLib.EDI.XML.Document)

^EnsLib.EDI.XML.DocumentD(ID,"UserValues",n)
=
UserValues(n)
FeedbackOpens in a new window