XmlDocument

Specializes Document for handling generic XML. (always uses strict mode, uses xml mime type and file header)

class XmlDocument : Document {}

Constructors

this
this(string data)
Undocumented in source.

Inherited Members

From Document

opIndex
ElementCollection opIndex(string selector)

This is just something I'm toying with. Right now, you use opIndex to put in css selectors. It returns a struct that forwards calls to all elements it holds, and returns itself so you can chain it.

_contentType
string _contentType;
Undocumented in source.
contentType
string contentType [@property setter]

If you're using this for some other kind of XML, you can set the content type here.

contentType
string contentType [@property getter]

implementing the FileResource interface, useful for sending via http automatically.

getData
immutable(ubyte)[] getData()

implementing the FileResource interface; it calls toString.

enableAddingSpecialTagsToDom
void enableAddingSpecialTagsToDom()

Concatenates any consecutive text nodes This will set delegates for parseSaw* (note: this overwrites anything else you set, and you setting subsequently will overwrite this) that add those things to the dom tree when it sees them. Call this before calling parse(). Note this will also preserve the prolog and doctype from the original file, if there was one.

parseSawComment
bool delegate(string) parseSawComment;

If the parser sees a html comment, it will call this callback <!-- comment --> will call parseSawComment(" comment ") Return true if you want the node appended to the document.

parseSawAspCode
bool delegate(string) parseSawAspCode;

If the parser sees <% asp code... %>, it will call this callback. It will be passed "% asp code... %" or "%= asp code .. %" Return true if you want the node appended to the document.

parseSawPhpCode
bool delegate(string) parseSawPhpCode;

If the parser sees <?php php code... ?>, it will call this callback. It will be passed "?php php code... ?" or "?= asp code .. ?" Note: dom.d cannot identify the other php <? code ?> short format. Return true if you want the node appended to the document.

parseSawQuestionInstruction
bool delegate(string) parseSawQuestionInstruction;

if it sees a <?xxx> that is not php or asp it calls this function with the contents. <?SOMETHING foo> calls parseSawQuestionInstruction("?SOMETHING foo") Unlike the php/asp ones, this ends on the first > it sees, without requiring ?>. Return true if you want the node appended to the document.

parseSawBangInstruction
bool delegate(string) parseSawBangInstruction;

if it sees a <! that is not CDATA or comment (CDATA is handled automatically and comments call parseSawComment), it calls this function with the contents. <!SOMETHING foo> calls parseSawBangInstruction("SOMETHING foo") Return true if you want the node appended to the document.

parseGarbage
void parseGarbage(string data)

Given the kind of garbage you find on the Internet, try to make sense of it. Equivalent to document.parse(data, false, false, null); (Case-insensitive, non-strict, determine character encoding from the data.) NOTE: this makes no attempt at added security.

handleDataEncoding
Utf8Stream handleDataEncoding(string rawdata, string dataEncoding, bool strict)
Undocumented in source. Be warned that the author may not have intended to support it.
parse
void parse(string rawdata, bool caseSensitive, bool strict, string dataEncoding)

Take XMLish data and try to make the DOM tree out of it.

parseStream
void parseStream(Utf8Stream data, bool caseSensitive, bool strict)
Undocumented in source. Be warned that the author may not have intended to support it.
title
string title [@property getter]

Gets the <title> element's innerText, if one exists

title
string title [@property setter]

Sets the title of the page, creating a <title> element if needed.

getElementById
Element getElementById(string id)
requireElementById
SomeElementType requireElementById(string id, string file, size_t line)
requireSelector
SomeElementType requireSelector(string selector, string file, size_t line)
querySelector
Element querySelector(string selector)
querySelectorAll
Element[] querySelectorAll(string selector)
getElementsBySelector
Element[] getElementsBySelector(string selector)
getElementsByTagName
Element[] getElementsByTagName(string tag)

These functions all forward to the root element. See the documentation in the Element class.

getFirstElementByTagName
Element getFirstElementByTagName(string tag)

FIXME: btw, this could just be a lazy range......

mainBody
Element mainBody()

This returns the <body> element, if there is one. (It different than Javascript, where it is called 'body', because body is a keyword in D.)

getMeta
string getMeta(string name)

this uses a weird thing... it's [name=] if no colon and [property=] if colon

setMeta
void setMeta(string name, string value)

Sets a meta tag in the document header. It is kinda hacky to work easily for both Facebook open graph and traditional html meta tags/

forms
Form[] forms()

.

createForm
Form createForm()

.

createElement
Element createElement(string name)

.

createFragment
Element createFragment()

.

createTextNode
Element createTextNode(string content)

.

findFirst
Element findFirst(bool delegate(Element) doesItMatch)

.

clear
void clear()

.

setProlog
void setProlog(string d)

.

prolog
string prolog [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString()

.

root
Element root;

.

piecesBeforeRoot
Element[] piecesBeforeRoot;

if these were kept, this is stuff that appeared before the root element, such as <?xml version ?> decls and <!DOCTYPE>s

piecesAfterRoot
Element[] piecesAfterRoot;

stuff after the root, only stored in non-strict mode and not used in toString, but available in case you want it

loose
bool loose;

.

eventObservers
void delegate(DomMutationEvent)[] eventObservers;
Undocumented in source.
dispatchMutationEvent
void dispatchMutationEvent(DomMutationEvent e)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta