AIBMass
asked on
Should I use XMLReader, XSLT or XPATH
Unfortunately I'm new to XML and am not sure if I should be pursuing XMLReader, XSLT or XPATH to solve the following easy problem. Could someone please suggest and possibly demonstrate a good approach? Comments on why you chose that approach would make this even more valuable.
Simplified XML file:
<beginningstuff>.......... .......</b eginningst uff>
<row><stuff1>....<stuff1>< from>A</fr om><morest uff>....</ morestuff> ....</row>
<row><stuff1>....<stuff1>< from>B</fr om><morest uff>....</ morestuff> ....</row>
<row><stuff1>....<stuff1>< from>A</fr om><morest uff>....</ morestuff> ....</row>
<row><stuff1>....<stuff1>< from>A</fr om><morest uff>....</ morestuff> ....</row>
I want to create an output XML document that contains the "beginningstuff" and only those "rows" that are "from" B. (In this case, that's just one row.)
What's the best way?
Simplified XML file:
<beginningstuff>..........
<row><stuff1>....<stuff1><
<row><stuff1>....<stuff1><
<row><stuff1>....<stuff1><
<row><stuff1>....<stuff1><
I want to create an output XML document that contains the "beginningstuff" and only those "rows" that are "from" B. (In this case, that's just one row.)
What's the best way?
ASKER
I'm going to look at this soon.
Is this adaptable to:
1. Choosing the rows that are not from 'B', including those that don't have a 'from'?
2. What if the valid values of 'from' need to be read from a config file?
Thanks.
Is this adaptable to:
1. Choosing the rows that are not from 'B', including those that don't have a 'from'?
2. What if the valid values of 'from' need to be read from a config file?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you grepll for your help.
Perhaps one last tidbit?
We receive an XML document from an outside source, which I can now envision transforming via an XSLT. But how does one accomplish this transfornation from inside a Windows app and end up with a new document that can be saved?
Best.
Perhaps one last tidbit?
We receive an XML document from an outside source, which I can now envision transforming via an XSLT. But how does one accomplish this transfornation from inside a Windows app and end up with a new document that can be saved?
Best.
ASKER
Never mind. Thanks again.
We will be using XSLTransform for others wishing to know - documented at this link:
http://support.microsoft.com/kb/300934
We will be using XSLTransform for others wishing to know - documented at this link:
http://support.microsoft.com/kb/300934
You're welcome.
> But how does one accomplish this transfornation from inside a Windows app and end up with a new document that can be saved?
That depends. One from many possible solutions is to use SAXON XSLT processor. That is library for Java and .NET and could be also used as standalone application from commandline:
java -jar saxon9he.jar -novw -o output.xml input.xml stylesheet.xsl
> But how does one accomplish this transfornation from inside a Windows app and end up with a new document that can be saved?
That depends. One from many possible solutions is to use SAXON XSLT processor. That is library for Java and .NET and could be also used as standalone application from commandline:
java -jar saxon9he.jar -novw -o output.xml input.xml stylesheet.xsl
Open in new window