|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] adding or modifing an attributeSam Carleton scarleton at miltonstreet.comWed Jun 4 13:02:51 PDT 2008
I have worked with DOM, SAX, XSLT, and XPath in the past and am now working with a framework that has XQuery. The task at hand is very simple, change (or add if not present) an attribute to one element in an XML document: Example: If the name element has an average attribute, change it to 93, otherwise create it and set it to 93 input: <root> <students> <name value="scott"/> </students> </root> or <root> <students> <name value="scott" average="90"/> </students> </root> output: <root> <students> <name value="scott" average="93"/> </students> </root> How might I do this with XQuery? The framework I am using is Trolltech's Qt which is a C++ framework. I am under the impression I am going to have to load the XML document into memory, execute the XQuery query on it that will result in a new XML document that I will then save over the original XML file, is that correct? I can figure out the Qt stuff, the real question is how would I put together a query to make this change in XQuery? Sam
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






