XPath: element & attributes' name & value
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 4
- Joined: Fri Oct 27, 2006 11:09 pm
XPath: element & attributes' name & value
XPath neophyte here...
I want to be able to drill down into a DOM object within Firefox and extract a particular element's attributes and their values.
For example, I would like to extract the string value of the attribute 'client' which is "COUNTRYWIDE".
DOM object within Javascript:
The Javascript code starts out as follows:
Code:
All I know for now, is how to grab the particular attribute. But I haven't found any info on how to extract its value(s). Is there a [@client].getValue structure or equiv?
What would be the W3C syntax here? I can't find it.
Thanks.
I want to be able to drill down into a DOM object within Firefox and extract a particular element's attributes and their values.
For example, I would like to extract the string value of the attribute 'client' which is "COUNTRYWIDE".
DOM object within Javascript:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<powerstream version="08.00" name="powerstream" memo="" disable="n">
<project client="COUNTRYWIDE" client_code="COU" project="COUPON_LETTER" project_code="CLTR" id="1" name="project" memo="" disable="n"/>
...
</powerstream>
Code:
Code: Select all
// Selecting 'id' attribute of element 'project':
var xpathResult = document.evaluate("//project[@client]", domDoc, null, XPathResult.ANY_TYPE, null );
What would be the W3C syntax here? I can't find it.
Thanks.
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