classafSizzle::SizzleXml

sys::Obj
  afSizzle::SizzleXml

Holds a representation of an XML document that may be queried with CSS selectors.

SizzleDoc is intended for re-use with multiple CSS selections:

sizzDoc := SizzleDoc("<html><p class='welcome'>Hello from Sizzle!</p></html>")
elems1  := sizzDoc.select("p.welcome")
elems2  := sizzDoc.select("html p")
add

Source

Void add(XElem elem)

Adds another root element.

fromXDoc

Source

static new fromXDoc(XDoc doc)

Create a SizzleXml from an XML document.

fromXElem

Source

static new fromXElem(XElem elem)

Create a SizzleXml from an XML element.

fromXml

Source

static new fromXml(Str xml)

Create a SizzleXml from an XML string.

get

Source

@Operator
XElem[] get(Str cssSelector, Bool checked := true)

An alias for select()

remove

Source

Void remove(XElem elem)

Removed the the given Elem.

root

Source

XElem root { private set }

Returns the root element of the XML document.

select

Source

XElem[] select(Str cssSelector, Bool checked := true)

Queries the document with the given CSS selector any returns any matching elements.

Throws ParseErr if the CSS selector is invalid and checked is true.

selectFrom

Source

XElem[] selectFrom(XElem parent, Str cssSelector, Bool checked := true)

Queries the document for elements under the given parent, returning any matches.

Throws ParseErr if the CSS selector is invalid and checked is true.

update

Source

Void update(XElem elem, Bool recurse := false)

Updates / refreshes the given Elem - must have already been added.