classafSizzle::SizzleDoc
sys::Obj afSizzle::SizzleDoc
Holds a representation of an XML document that may be queried with CSS selectors.
SizzleDoc
is intended for re-use with multiple CSS selections:
doc := SizzleDoc("""<html><p class="welcome">Hello from Sizzle!</p></html>""") elems1 := doc.select("p.welcome") elems2 := doc.select("html p")
- fromStr
static new fromStr(Str xml)
Create a
SizzleDoc
from an XML string.- fromXDoc
static new fromXDoc(XDoc doc)
Create a
SizzleDoc
from an XML document.- fromXElem
static new fromXElem(XElem elem)
Create a
SizzleDoc
from an XML element.- get
@
Operator
XElem[] get(Str cssSelector, Bool checked := true)An alias for
select()
- rootElement
XElem rootElement()
Returns the root element of the XML document
- select
XElem[] select(Str cssSelector, Bool checked := true)
Queries the xml document with the given CSS selector any returns any matching elements.
Throws
ParseErr
should the CSS selector by invalid andchecked
istrue
(else an empty list is returned).