View source code
Display the source code in std/xml.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Class std.xml.DocumentParser
Class for parsing an XML Document.
This is a subclass of ElementParser. Most of the useful functions are documented there.
Constructors
Name | Description |
---|---|
this
|
Constructs a DocumentParser. |
Fields
Name | Type | Description |
---|---|---|
onEndTag
|
void delegate(const(Element)) | Register a handler which will be called whenever an end tag is encountered which matches the specified name. You can also pass null as the name, in which case the handler will be called for any unmatched end tag. |
onStartTag
|
void delegate(ElementParser) | Register a handler which will be called whenever a start tag is encountered which matches the specified name. You can also pass null as the name, in which case the handler will be called for any unmatched start tag. |
Properties
Name | Type | Description |
---|---|---|
onCData [set]
|
void delegate(string) | Register a handler which will be called whenever a character data segment is encountered. |
onComment [set]
|
void delegate(string) | Register a handler which will be called whenever a comment is encountered. |
onPI [set]
|
void delegate(string) | Register a handler which will be called whenever a processing instruction is encountered. |
onText [set]
|
void delegate(string) | Register a handler which will be called whenever text is encountered. |
onXI [set]
|
void delegate(string) | Register a handler which will be called whenever an XML instruction is encountered. |
tag [get]
|
const(Tag) | The Tag at the start of the element being parsed. You can read this to determine the tag's name and attributes. |
Methods
Name | Description |
---|---|
factory
|
Create instance of class specified by the fully qualified name classname. The class must either have no constructors or have a default constructor. |
onTextRaw
|
Register an alternative handler which will be called whenever text is encountered. This differs from onText in that onText will decode the text, whereas onTextRaw will not. This allows you to make design choices, since onText will be more accurate, but slower, while onTextRaw will be faster, but less accurate. Of course, you can still call decode() within your handler, if you want, but you'd probably want to use onTextRaw only in circumstances where you know that decoding is unnecessary. |
opCmp
|
Compare with another Object obj. |
opEquals
|
Test whether this is equal to o .
The default implementation only compares by identity (using the is operator).
Generally, overrides for opEquals should attempt to compare objects by their contents.
|
parse
|
Parse an XML element. |
toHash
|
Compute hash function for Object. |
toString
|
Returns that part of the element which has already been parsed |
toString
|
Convert Object to a human readable string. |
Standards
Bugs
Currently only supports UTF documents.
If there is an encoding attribute in the prolog, it is ignored.
Authors
Janice Caron
License
Copyright © 1999-2018 by the D Language Foundation | Page generated by ddox.