xpath - is it possible to do this?
Questions about XML that are not covered by the other forums should go here.
xpath - is it possible to do this?
For example in this case:
<bla id = 2>
<A ruolo = 1>
....
</A>
</bla>
<bla id = 10>
<A ruolo = 12>
....
</A>
</bla>
i have to select node whose have attribute ruolo like 1 or 12, i need both nodes. How can i do this?
i made this:
xmlSubTreeNode.SelectNodes("//bla[descendant::*/@Ruolo=1 or /@Ruolo=12]");
But in this case this instruction read only the first condition without read the second (ruolo = 12) if i write AND it try to find a tag with the 2 condition into..and it find nothing..
Does anybody know if i can do this? or is it impossible?
thanks
Fid
<bla id = 2>
<A ruolo = 1>
....
</A>
</bla>
<bla id = 10>
<A ruolo = 12>
....
</A>
</bla>
i have to select node whose have attribute ruolo like 1 or 12, i need both nodes. How can i do this?
i made this:
xmlSubTreeNode.SelectNodes("//bla[descendant::*/@Ruolo=1 or /@Ruolo=12]");
But in this case this instruction read only the first condition without read the second (ruolo = 12) if i write AND it try to find a tag with the 2 condition into..and it find nothing..
Does anybody know if i can do this? or is it impossible?
thanks
Fid
Check the spelling of the elements/attributes, XML is case sensitive.
In your instance you have ruolo and in the XPath there is Ruolo.
For the following XML:
the following XPath
gives 2 results:
Regards,
George
In your instance you have ruolo and in the XPath there is Ruolo.
For the following XML:
Code: Select all
<test>
<bla id="2">
<A ruolo="1"> .... </A>
</bla>
<bla id="10">
<A ruolo="12"> .... </A>
</bla>
</test>
Code: Select all
//bla[A/@ruolo=1 or A/@ruolo=12]
Code: Select all
SystemID: E:\workspace\oXygen\samples\test.xml
Location: 2:0
Description: /test[1]/bla[1] - id="2"
SystemID: E:\workspace\oXygen\samples\test.xml
Location: 5:0
Description: /test[1]/bla[2] - id="10"
George
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service