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

Method Inventory

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

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

method CommittedMode(pMode As %Boolean = 1) as %Status [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
classmethod EnumerateDocTypesClose(ByRef qHandle As %Binary) as %Status [ Language = objectscript ]
classmethod EnumerateDocTypesExecute(ByRef qHandle As %Binary, Category As %String, IncludeBase As %Boolean) as %Status [ Language = objectscript ]
classmethod EnumerateDocTypesFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer) as %Status [ Language = objectscript ]
classmethod EnumerateTypeCategoriesClose(ByRef qHandle As %Binary) as %Status [ Language = objectscript ]
classmethod EnumerateTypeCategoriesExecute(ByRef qHandle As %Binary, Standard As %String = "") as %Status [ Language = objectscript ]
classmethod EnumerateTypeCategoriesFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer) as %Status [ Language = objectscript ]
classmethod GetContentArray(Output pContents, pMode As %String, pDocType As %String, pLevel As %Integer, pIncludeBase As %Boolean, pElem, pNodeAddr) as %Status [ Language = objectscript ]
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, pFormat As %String = "f") as EnsLib.EDI.XML.Document [ Language = objectscript ]

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.

The third pFormat defaults to f if not supplied.
Pass in d in the pFormat string parameter to include namespace declarations from the top of source document. The f format parameter will be added if not inluded in the parameter.
method GetValueAt(pPropertyPath As %String = "", pFormat As %String, Output pStatus As %Status, pDummy As %Boolean) as %String [ Language = objectscript ]
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 [ Language = objectscript ]
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) [ Language = objectscript ]
method IdentifierGet() as %String [ Language = objectscript ]
classmethod ImportFromDevice(Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document [ Language = objectscript ]
classmethod ImportFromFile(pFilename As %String, pDocNum As %Integer = 1, Output pStatus As %Status, pConfigItem As %String) as EnsLib.EDI.XML.Document [ Language = objectscript ]
classmethod ImportFromIOStream(pIOStream As %IO.I.CharacterStream, Output pStatus As %Status = $$$OK, ByRef pConfigItem As %String = "") as EnsLib.EDI.XML.Document [ Language = objectscript ]
classmethod ImportFromLibraryStream(pLibStream As %Stream.Object, Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document [ Language = objectscript ]
classmethod ImportFromString(pString As %String, Output pStatus As %Status, ByRef pConfigItem As %String) as EnsLib.EDI.XML.Document [ Language = objectscript ]
classmethod KillGlobals(Output pDeletedCount, pKeepExtentCount=0, pDisplayLog=1) [ Language = objectscript ]
method NameGet() as %String [ Language = objectscript ]
method OutputHTMLZen() as %Status [ Language = objectscript ]
Display Document as HTML
method OutputToDevice(pFormat As %String) as %Status [ Language = objectscript ]
method OutputToFile(pFilename As %String, pOverwrite As %Boolean, pFormat As %String) as %Status [ Language = objectscript ]
method OutputToIOStream(pIOStream As %IO.I.CharacterStream, pFormat As %String, pFlush As %Boolean = 1) as %Status [ Language = objectscript ]
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 [ Language = objectscript ]
method OutputToString(pFormat As %String, Output pStatus As %Status) as %String [ Language = objectscript ]
classmethod Purge(Output pDeletedCount As %Integer, pDaysToKeep As %Integer = 7, pDummy As %Boolean = 0) as %Status [ Language = objectscript ]
method RawContentGet() as %String [ Language = objectscript ]
method SetMaxCalcCache(size As %Integer) [ Language = objectscript ]
method SetSubDocumentAt(pSubDocument As EnsLib.EDI.XML.Document = "", pPropertyPath As %String = "") as %Status [ Language = objectscript ]
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 [ Language = objectscript ]
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 [ Language = objectscript ]
method TypeVersionGet() as %String [ Language = objectscript ]
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 [ Language = objectscript ]
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.

Inherited Methods

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);

Storage

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

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

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

^EnsLib.EDI.XML.DocumentD(ID,"UserValues",n)
=
UserValues(n)