XPath - How do i select attribute xsd:string?

G

Gerben Abbink

Hi there,

I need to select all attribute nodes with value "xsd:string" using XPath.
The input document is an XML Schema, e.g.:

...
<xsd:element type="xsd:string">
...

Node 'xsd:element' is actually in the XML Schema namespace (prefix "xsd"
maps to "http://www.w3.org/2001/XMLSchema"), so this XPath expression:

//node()[namespace-uri()="http://www.w3.org/2001/XMLSchema"]

selects node "xsd:element". So far so good.

But, how do i select the attribute "type"? This attribute is not in the XML
Schema namespace but when i use the "xsd" prefix the XPath processor thinks
i am referencing the XML Schema namespace.

Any ideas? Thanks.

- Gerben
 
R

Richard Tobin

Gerben Abbink said:
But, how do i select the attribute "type"? This attribute is not in the XML
Schema namespace but when i use the "xsd" prefix the XPath processor thinks
i am referencing the XML Schema namespace.

So don't use the prefix xsd! Just use @type to get the attribute.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top