The XmlStreamReader class is similar to the XMLStreamReader utility class from StAX.
The following are constructors for XmlStreamReader.
public XmlStreamReader(String xmlInput)
The following are methods for XmlStreamReader. All are instance methods.
public Integer getAttributeCount()
Type: Integer
This method is only valid on a start element or attribute XML events. The count for the number of attributes for an attribute XML event starts with zero.
public String getAttributeNamespace(Integer index)
Type: String
If no namespace is specified, null is returned. This method is only valid with start element or attribute XML events.
public String getAttributeValue(String namespaceUri, String localName)
Type: String
Returns null if the value is not found. You must specify a value for localName. This method is only valid with start element or attribute XML events.
public System.XmlTag getEventType()
Type: System.XmlTag
public String getLocalName()
Type: String
For start element or end element XML events, it returns the local name of the current element. For the entity reference XML event, it returns the entity name. The current XML event must be start element, end element, or entity reference.
public String getLocation()
Type: String
If the location is unknown, returns -1. The location information is only valid until the next method is called.
public String getNamespace()
Type: String
Returns null if the XML event does not have a prefix.
public Integer getNamespaceCount()
Type: Integer
public String getNamespacePrefix(Integer index)
Type: String
Returns null if this is the default namespace declaration. This method is only valid on a start element, end element, or namespace XML event.
public String getPIData()
Type: String
public String getPITarget()
Type: String
public String getPrefix()
Type: String
public String getText()
Type: String
The valid values for the different events are:
<!ENTITY Title "Salesforce For Dummies" > ]> <foo a=\"b\">Name &Title;</foo>';
public String getVersion()
Type: String
public Boolean hasName()
Type: Boolean
This method is only valid for start element and stop element XML events.
public Boolean hasNext()
Type: Boolean
This method returns false if the current XML event is end document.
public Boolean hasText()
Type: Boolean
The following XML events have text: characters, entity reference, comment and space.
public Boolean isCharacters()
Type: Boolean
public Boolean isEndElement()
Type: Boolean
public Boolean isStartElement()
Type: Boolean
public Boolean isWhiteSpace()
Type: Boolean
public Integer next()
Type: Integer
public Integer nextTag()
Type: Integer
This method throws an error if elements other than white space, comments, processing instruction, start elements or stop elements are encountered.
public Void setCoalescing(Boolean returnAsSingleBlock)
Type: Void
public Void setNamespaceAware(Boolean isNamespaceAware)
Type: Void
public String toString()
Type: String