I am trying to get the childNodes after parsing an XML string using something like:
fn.head(xdmp.unquote('<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>')).childNodes
I don't think this is the right way of doing this as I am getting the following output:
<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>
Could someone please help me with the right way of getting the child nodes of an XML string ?
Were you expecting to select the /wrapper
element or the /wrapper/e1
and /wrapper/e2
elements?
If you wanted to return the wrapper
element:
fn.head(xdmp.unquote('<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>'))
.root
or
fn.head(xdmp.unquote('<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>'))
.xpath("/wrapper")
If you wanted to return the childNodes of the wrapper
element:
fn.head(xdmp.unquote('<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>'))
.root.childNodes
or
fn.head(xdmp.unquote('<wrapper><e1>this is <b>e1</b></e1><e2>this is <b>e2</b></e2></wrapper>'))
.xpath("/wrapper/*")