0

I hope this question (or one similar) hasn't been asked before. Sincere apologies if it has.


From an XMLHttpRequest I'm receiving an XML file like the one shown below:

<?xml version="1.0"?>
<projects>
<project>
    <department>Engineering</department>
    <primary>TNT</primary>
    <secondary>Lighting</secondary>
    <name>Project Ipsum</name>
    <description>Lorem</description>
</project>

<project>
    <department>Engineering</department>
    <primary>Heating</primary>
    <secondary>Fabric</secondary>
    <name>Project random</name>
    <description>This project is a load of</description>
</project>
.
.
.
.
</projects>

Esentially I'm trying to "query" the XML file and pull out department, primary, secondary, name, and description for any project where (for instance) primary or secondary were TNT.

Any suggestions would be greatly appreciated. Thanks again.

1 Answer 1

1

The XMLHttpRequest object has a responseXML attribute which contains the parsed XML document. You can use standard DOM methods on it.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 DOM methods work mostly the same on XML as they do on HTML. The W3C originally only created the DOM for XML based technologies and then applied it to HTML where applicable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.