Node List nodes = get Node List From XPath Expression(); // you know how if (nodes.length == 0) return; // empty nodelist, xpath didn't select anything Node first = Item(0); // take the first from the list, your element // this is a shortcut for your example: // first is the actual selected element (a node) // First() returns the first child node, the "text node" (="Jasmine", ="28") // Node Value() replace the actual value of that text node with a new string First Child()Node Value("New Name or new age"); Document doc = Document Builder Instance()Document Builder().parse( new Input Source("data.xml")); XPath xpath = XPath Instance()XPath(); Node List nodes = (Node List) xpath.evaluate("//employee/name[text()='old']", doc, XPath Constants. As mentioned in two other answers here, as well as in your previous question: technically, XPath is not a way to "update" an XML document, but only to locate nodes within an XML document. If so, here are two examples of how to do it: is used to select parts of an XML document. But since it returns DOM objects (Elements, if memory serves, or maybe Nodes) you can then use DOM methods for altering the document.Whenever the value is selected in the "country" drop down list, the "states" drop down list will be populated with corresponding state values based on the country selected.This has to be done without a page refresh, by making AJAX calls to the servlet on the drop down list change event.4.As a result, information may be out of date and products may no longer be available.If you are interested in a product whose link does not work, search for it on the Web, as product pages frequently change and products/companies are frequently sold. Are you asking how to your DOM to an XML file after you've finished editing the DOM?
That was a very simple example I provided in that post by returning a piece of text from the servlet to JSP to start with, and now in this post I am going to add something more to it by making the servlet return complex Java Objects such as lists, maps, etc.Whether it is faster to return an entire document as a DOM tree or SAX events probably depends on the individual database, again with parsing speed competing against retrieval speed.Native XML databases differ from XML-enabled databases in three main ways: Developer: Four Thought URL: License: Open Source Database type: Object-oriented Entry last updated: November, 2001 From the Web site: "4Suite is a collection of Python tools for XML processing and object database management.It also provides support services such as distributed transactions, and access control lists.It supports remote, cross-platform and cross-language access through CORBA, SOAP and HTTP GET." Developer: University of Konstanz URL: License: Open Source Database type: Proprietary Entry last updated: February, 2010 Base X is a native XML database written in Java.In the above code, we create two maps for two countries, and return the one based on the country parameter passed to the servlet in the AJAX call made by the JQuery's get() method.