%XML.Namespaces
Class %XML.Namespaces Extends %RegisteredObject [ System = 3 ]
%XML.Namespace manages the XML namespaces for an XML document.
Properties
DefaultNamespace
Property DefaultNamespace As %String;
The default namespace to use when no namespace is specified for the current namespace. The namespace "" is treated as equivalent to an XML document with no namespace.
ElementQualified
Property ElementQualified As %Boolean [ InitialExpression = 0 ];
If true, the XML document is the the form specified by elementFormDefault="qualified". This is the default value to use if elementQualfied not specified in PushNodeForExport.
AttributeQualified
Property AttributeQualified As %Boolean [ InitialExpression = 0 ];
If true, the XML document is the the form specified by attributeFormDefault="qualified".
SuppressXmlns
Property SuppressXmlns As %Boolean [ InitialExpression = 0 ];
SuppressXmlns allows optionally suppression of the use of xmlns= to set default XML namespace when ElementQualified is false. If SuppressXmlns is true then a prefix is used for each tag rather than default namespace with xmlns=.
SuppressAutoPrefix
Property SuppressAutoPrefix As %Boolean [ InitialExpression = 0, Internal ];
SuppressAutoPrefix allows optionally suppression of the prefix that is created for the default XML namespace even if it is not needed for the current element.
DefaultXmlns
Property DefaultXmlns As %String;
DefaultXmlns allows optional specification of the XML namespace to use as the default XML namespace when SuppressXmlns is false.
OutputTypeAttribute
Property OutputTypeAttribute As %Boolean [ InitialExpression = 0 ];
OutputTypeAttribute allows the user to force the inclusion of the xsi:type attribute for each element of object output.
CurrentNamespace
Property CurrentNamespace As %String;
The namespace for the current node.
depth
Property depth As %Integer [ InitialExpression = 0, Internal, Private ];
The depth of the current namespace list. The depth property represents the number of times this identical namespace list has been pushed for a child node. This use of depth is an optimization to prevent the use of an instance of %XML.Namespaces for each level of child node.
stack
Property stack As %XML.Namespaces [ Internal, Private ];
The stack property points to the next %XML.Namespaces instance on the linked list that defines the stack of nodes.
maxPrefix
Property maxPrefix As %Integer [ InitialExpression = 0, Internal, Private ];
The maxPrefix property is the number for the next last prefix of the form "s"_..maxPrefix that was created.
namespaces
Property namespaces As %String [ Internal, MultiDimensional, Private ];
The namespaces that have already been defined. For each namespace, namespaces(prefix)=namespace.
prefixes
Property prefixes As %String [ Internal, MultiDimensional, Private ];
The prefixes associated with namespaces that have already been defined. Each entry in prefixes has a corresponding entry in namespaces. For each namespace, prefixes(namespace)=prefix.
locations
Property locations As %String [ Internal, MultiDimensional, Private ];
The schemaLocation associated with namespaces that have already been defined. Each entry in locations has a corresponding entry in namespaces. For each namespace, locations(namespace)=schemaLocation. If locations(namespace) node exists, then no schemaLocation attribute is to be output. If locations(namespace)="", then the schemaLocation attribute has already been output.
addedNamespaces
Property addedNamespaces As %String [ Internal, MultiDimensional, Private ];
The namespaces that will be defined for child nodes. These namespaces do not yet have there prefix defined even though the prefix may be specified as a hint. For each added namespace and prefix, addedNamespaces(namespace,prefix)=schemaLocation.
removeNamespaces
Property removeNamespaces As %String [ Internal, MultiDimensional, Private ];
These namespaces where added temporarily
DefaultDefined
Property DefaultDefined As %String;
The default namespace that the XML document has defined or "" if none.
SaveDefaultDefined
Property SaveDefaultDefined As %String;
Save default namespace when making temporary change before calling XMLExportInternal in order to support form="unqualified"
CurrentElementQualified
Property CurrentElementQualified As %Boolean [ Internal, Private ];
The current value of ElementQualified.
Stable
Property Stable As %Boolean [ Internal ];
Stable is true, if the same prefixes may be used if the current namespace does not change
DefaultPrefix
Property DefaultPrefix As %String [ MultiDimensional ];
DefaultPrefix(namespace)=prefix is an array of default prefixes to be used for adding namespaces when no prefix is defined.
Methods
OutputTypeAttributeSet
Method OutputTypeAttributeSet(value As %Boolean) As %Status [ Internal ]
RestoreOutputTypeAttribute
Method RestoreOutputTypeAttribute(value As %Boolean) As %Status [ Internal ]
Restore the value of OutputTypeAttribute without adding the schema namespaces again.
PushNode
Method PushNode(namespace As %String = "") As %Status
Push a new current namespace onto the stack of active namespaces.
namespace is the XML namespace for the elements of the node that is being created. This method does not actually create the node. It just does the required namespace handling. If this namespace has not yet been added, it will also be added with a default prefix. The default namespace will be the namespace for the node if "" is specified.
SetDefaultDefined
Method SetDefaultDefined(defaultdefined As %String) [ Internal, Private ]
Set new value of DefaultDefined property. If the value of DefaultDefined changes, then make sure that this node is at depth=1.
PopDefaultDefined
Method PopDefaultDefined() [ Internal ]
Pop previous value of DefaultDefined property.
SetCurrentElementQualified
Method SetCurrentElementQualified(elementQualified As %Boolean) [ Internal, Private ]
Set new value of CurrentElementQualified property. If the value of CurrentElementQualified changes, then make sure that this node is at depth=1.
SetSuppressXmlns
Method SetSuppressXmlns(suppressxmlns As %Boolean) [ Internal, Private ]
Set new value of SuppressXmlns property. If the value of SuppressXmlns changes, then make sure that this node is at depth=1.
SetStable
Method SetStable(stable As %Boolean) [ Internal ]
Set new value of Stable property. If the value of Stable changes, then make sure that this node is at depth=1.
PushNodeForExport
Method PushNodeForExport(namespace As %String = "", local As %Boolean, defaultPrefixRequired As %Boolean, elementQualified As %Boolean, attributeQualified As %Boolean, Output topPrefix As %String, Output topAttrs As %String, Output typesPrefix As %String, Output attrsPrefix As %String, Output usePrefix As %Boolean, forceStable As %Boolean) As %Status [ Internal ]
Push a new current namespace onto the stack of active namespaces and return information needed by XMLExport.
This method is for internal use only. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this method.
namespace is the XML namespace for the elements of the node that is being created. This mehod does not actually create the node. It just does the required namespace hadnling. If this namespace has not yet been added, it will also be added with a default prefix. The default namespace will be the namespace for the node if "" is specified.
local specifies if the element is treated as a local element. A global element is specified by a false value of local which can be either 0 to represent a global element in the namespace specified by the namespace argument or a string which is the namespace to which the global element belongs. The default for local is 0.
defaultPrefixRequired specifies if the prefix for the default namespace must be defined. elementQualified specifies override for ElementQualified property.
The following are returned for use the XMLExport based on the new current namespace:
topPrefix is the prefix (or "") to be used for the next top containing tag.
topAttrs is any xmlns attributes needed to define topPrefix.
typesPrefix is the prefix to be used for type references in the object being exported.
attrsPrefix is the prefix (or "") to be used for any attributes of this object.
soapPrefix is prefix to be used for the SOAP encoding namespace.
schemaPrefix is prefix to be used for the XML schema namespace.
xsiPrefix is prefix to be used for the XML schema instance namespace.
xsiAttrs is any xmlns attributes needed to define the XML schema instance namespace.
PopNode
Method PopNode()
Pop the namespace information for the last node pushed.
PopNamespaces
Method PopNamespaces() [ Internal ]
Remove any prefix definitions that were introduced just for one class
GetXMLPrefixes
Method GetXMLPrefixes(Output soapPrefix As %String, Output schemaPrefix As %String, Output xsiPrefix As %String, Output xsiAttrs As %String) [ Internal ]
Get SOAP, Schema and Schema instance prefixes
AddNamespace
Method AddNamespace(namespace As %String, prefix As %String, schemaLocation As %String = "", allowMultiplePrefixes As %Boolean = 0) As %Status
Add a namespace definition to the current level. PopNode will remove this definition. The next PushNode... will cause the attributes to be created for adding this namespace to the XML document.
prefix is the optional preferred prefix for this namespace. If no prefix is specified, a unique prefix will be computed.
A schemaLocation attribute value for the first definition of this namespace may also specified.
If allowMultiplePrefixes is true then multiple prefixes may be defined for the same namespace. The default is false which will override the previously defined prefix for the same namespace.
GetNamespacePrefix
Method GetNamespacePrefix(namespace As %String, ByRef attrs) As %String
DefineAllNamespacePrefixes
Method DefineAllNamespacePrefixes(prefixRequired As %Boolean = 1)
Make prefix definition for all newly added namespaces.
DefineNamespacePrefix
Method DefineNamespacePrefix(namespace As %String, prefixRequired As %Boolean = 1, prefix As %String)
Make prefix definition for a new namespace at the current level. Optionally force the prefix to be used by specifying 3rd argument.
RemoveNamespacePrefix
Method RemoveNamespacePrefix(namespace As %String) [ Internal ]
Remove the prefix definition for an existing namespace at the current level.
AddInstanceNamespace
Method AddInstanceNamespace(prefix As %String) As %Status
Add a the XML Schema instance namespace definition to the current level. PopNode will remove this definition. The next PushNode... will cause the attributes to be created for adding this namespace to the XML document.
prefix is the optional preferred prefix for this namespace. If no prefix is specified, a unique prefix will be computed.
AddSchemaNamespace
Method AddSchemaNamespace(prefix As %String) As %Status
Add a the XML Schema namespace definition to the current level. PopNode will remove this definition. The next PushNode... will cause the attributes to be created for adding this namespace to the XML document.
prefix is the optional preferred prefix for this namespace. If no prefix is specified, a unique prefix will be computed.
AddSOAPNamespace
Method AddSOAPNamespace(soapPrefix As %String, schemaPrefix As %String, xsiPrefix As %String) As %Status
Add the SOAP 1.1 encoding namespace, the XML schema namespace and the XML Schema instance namespace definitions to the current level. PopNode will remove these definitions. The next PushNode... will cause the attributes to be created for adding these namespaces to the XML document.
soapPrefix, schemaPrefixPrefix and xsiPrefix are the optional preferred prefix for these namespaces. If no prefix is specified, a unique prefix will be computed.
AddSOAP12Namespace
Method AddSOAP12Namespace(soapPrefix As %String, schemaPrefix As %String, xsiPrefix As %String) As %Status
Add the SOAP 1.2 encoding namespace, the XML schema namespace and the XML Schema instance namespace definitions to the current level. PopNode will remove these definitions. The next PushNode... will cause the attributes to be created for adding these namespaces to the XML document.
soapPrefix, schemaPrefixPrefix and xsiPrefix are the optional preferred prefix for these namespaces. If no prefix is specified, a unique prefix will be computed.
GetNewPrefix
Method GetNewPrefix(prefix As %String, bTemp As %Boolean = 0) As %String
Get a new unique prefix.
GetPrefix
Method GetPrefix(namespace As %String) As %String [ CodeMode = expression ]
Get the prefix for the specified namespace at the current stack level. "" is returned if the namespace is not defined.
GetNextDefinedNamespace
Method GetNextDefinedNamespace(namespace As %String) As %String [ CodeMode = expression ]
Get the next namespace
GetNamespace
Method GetNamespace(prefix As %String) As %String [ CodeMode = expression ]
Get the namespace for the specified prefix at the current stack level. "" is returned if the prefix is not defined.
Copy
Method Copy(source As %XML.Namespaces) [ Internal ]
Fill myself from the specified instance
Reset
Method Reset()
Reset myself
GetNextNamespace
ClassMethod GetNextNamespace(namespace As %String) As %String [ CodeMode = expression ]
GetNextNamespace returns the next XML namespace in name order. A return of "", indicates no more XML namespaces to list.
GetNextClass
ClassMethod GetNextClass(namespace As %String, class As %String) As %String [ CodeMode = expression ]
GetNextClass returns the next class in the XML namespace in class name order. A return of "", indicates no more classes to list. Note that namespace="" indicates classes without an XML namespace defined.