Skip to main content

%XML.TextReader

Class %XML.TextReader Extends %RegisteredObject [ Not ProcedureBlock, ServerOnly = 1, System = 3 ]

For details on using this class, see Using %XML.TextReader.

Properties

AttributeCount

Property AttributeCount As %Integer;

Public property, Only applicable to element nodes. Returns the number of attributes on the current node.

Depth

Property Depth As %Integer;

Public property, The depth of the current node in the XML document.

EOF

Property EOF As %Boolean;

Public property, true if the reader is positioned at the end of the stream; otherwise, false.

HasAttributes

Property HasAttributes As %Boolean;

Public property, Gets a value indicating whether the current node has any attributes. true if the current node has attributes; otherwise, false.

HasValue

Property HasValue As %Boolean;

Public property, returns true if the node on which the reader is currently positioned can have a Value; otherwise, false. The following lists node types and the corresponding values:

Node Type :: Value

attribute :: The value of the attribute.
comment :: The content of the comment.
processinginstruction :: The entire content of the processing instruction, excluding the target.
ignorablewhitespace :: The white space between markup in a mixed content model.
chars :: The content of the text node.
startprefixmapping :: The prefix and uri of the mapping
endprefixmappping :: The prefix of the mapping

IsEmptyElement

Property IsEmptyElement As %Boolean;

Public property, returns true if the current element is empty

LocalName

Property LocalName As %String;

Public property, The name of the current node with the prefix removed. For example, LocalName is book for the element bk:book. The name returned is dependent on the NodeType of the node. The following node types return the listed values. All other node types return an empty string. Name: Attribute
Value: The name of the attribute.

Name: Element
Value: The tag name.

Name

Property Name As %String;

Public property,The qualified name of the current node. For example, Name is bk:book for the element bk:book. The name returned is dependent on the NodeType of the node. The following node types return the listed values. All other node types return an empty string. Name: Attribute
Value: The name of the attribute.

Name: Element
Value: The tag name.

Name: EntityReference
Value: The name of the entity referenced.

Name: ProcessingInstruction
Value: The target of the processing instruction.

Name: StartPrefixMapping
Value: The prefix of the mapping and the uri mapped, delimited by a single space

Name: EndPrefixMapping
Value: The prefix of the mapping

NamespaceUri

Property NamespaceUri As %String;

Public property, The namespace URI of the current node; otherwise an empty string. This property is relevant to Element and Attribute nodes only.

NodeType

Property NodeType As %String;

Public property, contains the node type of the current node as indicated by the following list:

attribute
cdata
comment
processinginstruction
ignorablewhitespace
chars
element
entity
endelement

Path

Property Path As %String;

Public property, contains the current path to the containing element

ReadState

Property ReadState As %String [ InitialExpression = "Initial" ];

Public property, returns the current read state of the reader The following table lists the states and their meanings

EndOfFile: The end of the file has been reached successfully.

Initial: The Read method has not been called.

Interactive: The Read method has been called. Additional methods may be called on the reader.

Value

Property Value As %String;

Public property, returns the value of the current node. The following types have a value to return:

Node Type :: Value

attribute :: The value of the attribute.

cdata :: The content of the CDATA section.

comment :: The content of the comment.

processinginstruction :: The entire content of the processing instruction, excluding the target.

ignorablewhitespace :: The white space between markup in a mixed content model.

chars :: The content of the text node.

entity :: The expanded content of the entity

attrseq

Property attrseq As %Integer [ InitialExpression = 0, Private ];

hasContent

Property hasContent As %String [ Private ];

seq

Property seq As %Integer [ InitialExpression = 0 ];

target

Property target As %Integer [ Private ];

priorpath

Property priorpath As %String [ Private ];

GlobalName

Property GlobalName As %String;

Methods

%OnClose

Method %OnClose() As %Status

%OnNew

Method %OnNew(pInitval As %Integer, pGlobalName As %String = "^IRIS.Temp") As %Status

AttributeCountGet

Method AttributeCountGet() As %Integer

AttributeCount Implementation

DepthGet

Method DepthGet() As %Integer

Depth Implementation

EOFGet

Method EOFGet() As %Boolean

EOF Implementation

HasAttributesGet

Method HasAttributesGet() As %Boolean

HasAttributes Implementation

HasValueGet

Method HasValueGet() As %Boolean

HasValue Implementation

IsEmptyElementGet

Method IsEmptyElementGet() As %Boolean

IsEmptyElement Implementation

LocalNameGet

Method LocalNameGet() As %String

LocalName implementation

MoveToAttributeIndex

Method MoveToAttributeIndex(pIndex As %String) As %Boolean

Moves to the attribute with the specified index. returns true on success false otherwise

MoveToAttributeName

Method MoveToAttributeName(pName As %String, pUri As %String = "") As %Boolean

MoveToContent

Method MoveToContent() As %Boolean

Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity) node. If the node is not a content node, the reader skips ahead to the next content node or end of file. It skips over nodes of the following types: processinginstruction, comment, ignorablewhitespace,endelement

MoveToElement

Method MoveToElement() As %Boolean

Moves to the associated element when the current node is of type attribute

NameGet

Method NameGet() As %String

Name implementation

NamespaceUriGet

Method NamespaceUriGet() As %String

NamespaceUri Implementation

NodeTypeGet

Method NodeTypeGet() As %String

NodeType implementation

ParseFile

ClassMethod ParseFile(Filename As %String, Output TextReader As %XML.TextReader, Resolver As %XML.SAX.EntityResolver = {$$$NULLOREF}, Flags As %Integer = {$$$SAXDEFAULTS}, Mask As %Integer = {$$$SAXCONTENTEVENTS}, SchemaSpec As %String = "", KeepWhiteSpace As %Boolean = 0, GlobalName As %String = "^||IRIS.Temp") As %Status [ Final ]

This method takes the name of a file to be parsed and a reference to a variable which, upon success, will be set to a new instance of an %XML.TextReader. Optionally, additional arguments specifying an Entity resolver, Flags , Mask and SchemaSpec be passed. Please see class %XML.SAX.Parser for a full description of these optional parameters.

ParseStream

ClassMethod ParseStream(Stream As %AbstractStream, Output TextReader As %XML.TextReader, Resolver As %XML.SAX.EntityResolver = {$$$NULLOREF}, Flags As %Integer = {$$$SAXDEFAULTS}, Mask As %Integer = {$$$SAXCONTENTEVENTS}, SchemaSpec As %String = "", KeepWhiteSpace As %Boolean = 0, GlobalName As %String = "^||IRIS.Temp") As %Status [ Final ]

This method takes a Stream to be parsed and a reference to a variable which, upon success, will be set to a new instance of an %XML.TextReader. Optionally, additional arguments specifying an Entity resolver, Flags , Mask and SchemaSpec be passed. Please see class %XML.SAX.Parser for a full description of these optional parameters.

ParseString

ClassMethod ParseString(String As %String, Output TextReader As %XML.TextReader, Resolver As %XML.SAX.EntityResolver = {$$$NULLOREF}, Flags As %Integer = {$$$SAXDEFAULTS}, Mask As %Integer = {$$$SAXCONTENTEVENTS}, SchemaSpec As %String = "", KeepWhiteSpace As %Boolean = 0, GlobalName As %String = "^||IRIS.Temp") As %Status [ Final ]

This method takes a String to be parsed and a reference to a variable which, upon success, will be set to a new instance of an %XML.TextReader. Optionally, additional arguments specifying an Entity resolver, Flags , Mask and SchemaSpec be passed. Please see class %XML.SAX.Parser for a full description of these optional parameters.

ParseURL

ClassMethod ParseURL(URL As %String, Output TextReader As %XML.TextReader, Resolver As %XML.SAX.EntityResolver = {$$$NULLOREF}, Flags As %Integer = {$$$SAXDEFAULTS}, Mask As %Integer = {$$$SAXCONTENTEVENTS}, SchemaSpec As %String = "", KeepWhiteSpace As %Boolean = 0, pHttpRequest As %Net.HttpRequest = {$$$NULLOREF}, GlobalName As %String = "^||IRIS.Temp") As %Status [ Final ]

This method takes a URL to be parsed and a reference to a variable which, upon success, will be set to a new instance of an %XML.TextReader. Optionally, additional arguments specifying an Entity resolver, Flags , Mask and SchemaSpec be passed. Please see class %XML.SAX.Parser for a full description of these optional parameters.

PathGet

Method PathGet() As %String

Implementation of Path property.

Read

Method Read() As %Boolean

Reads the next node from the stream. Returns true if the next node was read successfully; false if there are no more nodes to read. When an XmlReader is first created and initialized, there is no information available. You must call Read to read the first node. Each node has a particular type. There is not necessarily a one to one correspondence between the number of nodes in a document and the number of identifiable xml components. For example,the cdata, comment and chars nodes contain textual information which corresponds to their XML equivalent in the document. However a single XML component of type chars may be spread over a number of nodes of the same type. This is entirely due to the way the XML engine processes the document. Therefore if you do a read and the node type is character, for example, then you have to continue reading until the node type changes to ensure that you have seen all the character data.

ReadStartElement

Method ReadStartElement(pName As %String, pUri As %String = "") As %Boolean

Advances to the first element that matches the provided name and (optional) namespace uri Returns true on success, false if the element could not be matched

ReadStateGet

Method ReadStateGet() As %String

ReadState Implementation

Rewind

Method Rewind()

Resets the reader to the initial state

ValueGet

Method ValueGet() As %String

Value Implementation

hasContentGet

Method hasContentGet() As %Boolean [ Private ]

HasContent Implementation