Skip to main content

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 ByPassPropCacheForMixed as %Boolean [ InitialExpression = 0 , Transient ];
When setting 'raw' XML to a Property path (as opposed to a DOM path) this flag allows setting the data directly to the internal DOM storage.
Whilst this might improve performance the output may have nodes in a different order than desired when combining with single property path sets.
This setting is provided for backwards compatibility.
The default is to set to the internal intermediary Property storage.
Property methods: ByPassPropCacheForMixedDisplayToLogical(), ByPassPropCacheForMixedGet(), ByPassPropCacheForMixedIsValid(), ByPassPropCacheForMixedLogicalToDisplay(), ByPassPropCacheForMixedLogicalToXSD(), ByPassPropCacheForMixedNormalize(), ByPassPropCacheForMixedSet(), ByPassPropCacheForMixedXSDToLogical()
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(), 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(), 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(), 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(), TypeVersionIsValid(), TypeVersionLogicalToDisplay(), TypeVersionLogicalToOdbc(), TypeVersionNormalize(), TypeVersionSQLCompute()

Methods

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, pFormat As %String = "f") 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.

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
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
  • g : suppress output of empty elements
  • 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.
The XML representation is the GetValueAt using "/1" as the property path except if the target Property Path where the sub document is to be set is of type "any" then the XML representation of pSubDocument retrieved will be the full document including top element i.e. path "/"
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 (Extent on ) [Extent, Type = bitmap];
Index methods: ExtentClose(), ExtentExecute(), ExtentFetch(), ExtentFetchRows(), ExtentFunc(), ExtentGetInfo(), ExtentGetODBCInfo(), ExtentPrepare(), ExtentSendODBC()
index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()
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

Inherited Methods

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)
FeedbackOpens in a new tab