Searching in xml using JDom or XPath

Hii Javaties
I need to search my xml file,so that i can retreive all the clerks under a particular manager
say all the clerks under manager 1.
Right now i am using DOM.
What will be the best approach to do searching .
Should i use XPAth ?
My xml structure is
<ROWSET>
<ROW num="1">
<Manager_Name>M1</Manager_Name>
<Clerks>
<Clerk_Item>
<Clerk_Name>M1C1</Clerk_Name>
</Clerk_Item>
<Clerk_Item>
<Clerk_Name>M1C2</Clerk_Name>
</Clerk_Item>
</Clerks>
</ROW>
<ROW num="2">
<Manager_Name>M2</Manager_Name>
<Clerks>
<Clerk_Item>
<Clerk_Name>M2C1</Clerk_Name>
</Clerk_Item>
<Clerk_Item>
<Clerk_Name>M2C2</Clerk_Name>
</Clerk_Item>
</Clerks>
</ROW>
</ROWSET>

Hi Anirban
I think you are looking for same info which is asked in this thread:Search using MDM java API
Have a look on this article as well to get the better understanding on MDM Java API Search: http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9039f92b-714b-2c10-d49f-a0cdf4e27dc6
Cheers/ -Tarun

Similar Messages

  • How to edit xml using jdom

    hi
    how to read and edit xml file using jdom, i tried using
    javax.xml.transform.*; // JAXP
    javax.xml.transform.dom.DOMSource; //
    i can read xml file . but iam not able to edit the xml file.
    how to achive this

    1. Select nodes to be modified with the JDom XPath class selectSingleNode and selectNodes methods.
    SAXBuilder saxBuilder=new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    org.jdom.Document jdomDocument=saxBuilder.build(new File("c:/input.xml"));
    org.jdom.Element node= (org.jdom.Element)(XPath.selectSingleNode(jdomDocument,"/root/node"));
    2. Modify the node values with the Element class setter methods.
    3. Output document with the XMLOutputer class.

  • Parsing Xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

  • Parsing a XML using Jdom --- Problem pls help

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • Problem parsing a xml using Jdom

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    One suggestion to try:
    Change your code to the following
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    Namespace ns = Namespace.getNamespace(
      "http://schemas.xmlsoap.org/ws/2003/03/business-process/" );
    List list= root.getChildren("partnerLinks", ns );
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());The JavaDoc says for the one-arg getChildren()
    If this target element has no nested elements with the given name outside a namespace, an empty List is returned.
    Your elements have a namespace (the default one) so it should be worth a try.
    Dave Patterson

  • REMOVING BLANK SPACE IN XML USING JDOM

    <?xml version="1.0" encoding="UTF-8"?>
    <Person >
    <Employee1>
    </Employee1>
    <Employee2>
    </Employee2>
    <Employee3>
    </Employee3>
    </Person>
    I want to remove <Employee2>
              </Employee2>
    and my output should look like this
    <Person >
    <Employee1>
    </Employee1>
    <Employee3>
    </Employee3>
    </Person>
    so i have written code
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.JDOMException;
    import org.jdom.input.SAXBuilder;
    String str = "C://Employee.xml"
    SAXBuilder builder = new SAXBuilder();
    document = builder.build(str);
    Element root = document.getRootElement();
    Element employeeChild1 = root.getChild("Employee1");
    Element employeeChild2 = root.getChild("Employee2");
    employeeChild1.getParent().removeContent(employeeChild1);
    employeeChild2.getParent().removeContent(employeeChild2);
    File file = new File( fileName );
    fos = new FileOutputStream( file );
    Format format = Format.getRawFormat();
    format.setOmitDeclaration(false);
    format.setTextMode(Format.TextMode.PRESERVE);
    outp = new XMLOutputter( format );
    outp.escapeElementEntities(" ");
    outp.output( document, fos );
    fos.flush();
    when i run this code my output comes like this in editplus
    <Person >
    <Employee1>
    </Employee1>
    <Employee3>
    </Employee3>
    </Person>
    and in internet explorer it shows correct
    <Person >
    <Employee1>
    </Employee1>
    <Employee3>
    </Employee3>
    </Person>
    i want to know how can i delete that blank line also because internet explorer adjust the settings and delete blank line but i want to view in editplus
    Element is getting deleted but the index is not getting deleted
    Please let me know Thanks in advance

    Is this an InDesign question? You are talking about PDFs. Are they exported from InDesign, and you are asking how to fix them some way in InDesign before exporting again to PDF? Or are you placing PDFs into InDesign. If neither of these is your question, you may want to ask over in the Acrobat forum.

  • Hot to parse XML using JDOM?

    <Case caseID="1808977179">
    <attr name="create_time">2003-12-04 16:42:19.0</attr>
    <attr name="name">1KEEJCE</attr>
    <attr name="owner_id">2yawpgx5vhpus</attr>
    <attr name="expected_closure">2003-12-04 16:42:19.0</attr>
    <attr name="subject">test tech support case</attr>
    </Case>
    obviously my attribute name (which is also named as "name") is the same for all my five entries. How can I parse all of them?I can only parse the first entry.

    this is the comp xml file:
    <GetUserCasesResponse>
         <Case caseID="1808977179">
         <attr name="name">1KEEJCE</attr>
         <attr name="create_time">2003-12-04 16:42:19.0</attr>     
         <attr name="owner_id">2yawpgx5vhpus</attr>
         <attr name="expected_closure">2003-12-04 16:42:19.0</attr>
         <attr name="subject">test tech support case</attr>
         </Case>
         <Case caseID="1326717944">
         <attr name="name">2DC65T5</attr>
         <attr name="create_time">2003-12-04 16:46:02.0</attr>
         <attr name="owner_id">2yawpgx5vhpus</attr>
         <attr name="expected_closure"></attr>
         <attr name="subject">test tech support case</attr>
         </Case>
         <Case caseID="1489179651"><attr name="name">16ZUFEZ</attr>
         <attr name="create_time">2003-12-04 16:48:15.0</attr>
         <attr name="owner_id"></attr>
         <attr name="expected_closure">2003-12-04 16:48:15.0</attr>
         <attr name="subject">test tech support case</attr>
         </Case>
         <Case caseID="1145690438"><attr name="name">2Y3XDR7</attr>
         <attr name="create_time">2003-12-04 16:56:17.0</attr>
         <attr name="owner_id">2yawpgx5vhpus</attr>
         <attr name="expected_closure">2003-12-04 16:56:17.0</attr>
         <attr name="subject">testing</attr>
         </Case>
         <Case caseID="1145690438"><attr name="name">2Y3XDR7</attr>
         <attr name="create_time">2003-12-04 16:56:17.0</attr>
         <attr name="owner_id">2yawpgx5vhpus</attr>
         <attr name="expected_closure">2003-12-04 16:56:17.0</attr>
         <attr name="subject">testing</attr>
         </Case>
    </GetUserCasesResponse>
    this is my code:
         public static void readXML( )
              try
                   SAXBuilder builder = new SAXBuilder( false );
                   Document doc = builder.build( new File(filenameConstant ) );
                   Element root = doc.getRootElement();
                   List listCase = root.getChildren("Case");
                   Iterator iterateCase = listCase.iterator();
                   while(iterateCase.hasNext())
                        Element attr = (Element) iterateCase.next();
                        System.out.println("" + attr.getChild("attr").getText() );
              catch( Exception e)
                   e.printStackTrace();
    This is my output:
    1KEEJCE
    2DC65T5
    16ZUFEZ
    2Y3XDR7
    2Y3XDR7
    Press any key to continue...
    Obviously I can only get the first element (<attr name="name">1KEEJCE</attr>
    ) of each cases,how can I get the other four given that they have the same attribute name ( which is named "name" ).

  • Error while try to read XML using JDOM

    hi' i don't know what's wrong with this. i try to read my XML document, but i already got exception when i try to initialize it.
    public class readXML
         public readXML()
              try
                   SAXBuilder builder = new SAXBuilder();
                   Document doc = builder.build("XMLTutorial/data.xml");     
              catch(Exception e)
                   e.printStackTrace();
         public static void main(String[] args)
              new readXML();
    }This is my XML Document :
    <f:table>
       <f:name>African Coffee Table</f:name>
       <f:width>80</f:width>
       <f:length>120</f:length>
    </f:table>when i try to run it, i got this exception :
    Caused by: org.xml.sax.SAXParseException: The prefix "f" for element "f:table" is not bound.what's wrong?
    Thanks a lot.

    Namespace prefixes must always be bound to a namespace.
    http://www.w3.org/TR/xml-names11/#sec-namespaces
    For example:<f:table xmlns:f="some namespace">
      <f:name>African Coffee Table</f:name>
      <f:width>80</f:width>
      <f:length>120</f:length>
    </f:table>

  • Search Configuration XML import using SharePoint App

    I'm trying to import a search configuration XML using a SharePoint App.
    I have check the following:
     - The XML is correct. I can upload it manually.
     - The code works using a console app, but not using the SharePoint app.
    Following code:
    SearchConfigurationPortability searchConfig = new SearchConfigurationPortability(this.Context);
    SearchObjectOwner owner = new SearchObjectOwner(this.Context, SearchObjectLevel.SPWeb);
    searchConfig.ImportSearchConfiguration(owner, configurationLocation);
    this.Context.Load(searchConfig);
    this.Context.ExecuteQuery();
    Following error message:
        ServerException was caught
        The server was unable to process the request due to an internal error.
        For more information about the error, either turn on IncludeExceptionDetailInFaults
        (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior)
        on the server in order to send the exception information back to the client, or turn on
        tracing as per the Microsoft .NET Framework SDK documentation and inspect the server
        trace logs.
    Thanks!

    I'm deploying the app to a SharePoint dev environment in the cloud so I can't see the ULS Logs, unfortunately. The link you suggested states that "managed properties aren’t supported in this deployment model" and this is exactly what I'm trying to provision.
    Any other ideas why the above code fails, although stated exactly on http://msdn.microsoft.com/en-us/library/office/dn205276(v=office.15).aspx?

  • Adding CDATA To every element in xml _ JDOM

    Hi,
    I need to parse xml using JDOM and add
    CDATA to every element.
    Could anyone help me in that ?
    When I append CDATA using org.jdom.Element.setText("<!CDATA"+Mystring +"]]>" );
    CDATA has been treated like text but not as an instruction .

    Question: Please see the code below.............
    I am copying a text which is in Hindi(DBWT-yogesh font) in JTextPane. When I am trying to retrieve hindi text from JTextpane using getText() I am obtaining hashampersand123,hashampersand156(hashsymbol,ampsymbol,123;like that ) some thing like this.
    If I dont set contentType to text/html and use getText()
    I obtain some junk characters. If I copy those junk characters in xml
    and view the xml with notepad and change the font to DBWT-yogesh
    I can see hindi text.
    I need to setContentType to html because I want to display text
    as bold or italic depending on html tags in content. when I use getText() I obtain some thing like this. If I store these characters even after changing font to DBWT-Yogesh I am not able to see hindi text.
    I want to convert (hashsymbol,ampsymbol,123;like that ) to junk characters so that when I change font using notepad I must be able to see hindi text.
    Please provide help............................. your earlier answer took me in the right direction.
    package swin;
    import java.awt.Font;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowListener;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    public class TextPaneProblem extends JFrame implements WindowListener{
    JTextPane jtp=null;
    public TextPaneProblem() {
    jtp=new JTextPane();
    jtp.setContentType("text/html");
    jtp.setFont(new Font("DWB-Yogesh",Font.PLAIN,24));
    getContentPane().add(jtp);
    setVisible(true);
    public static void main(String[] args) {
    TextPaneProblem TPP=new TextPaneProblem();
    TPP.addWindowListener(TPP);
    public void windowOpened(WindowEvent e) {
    public void windowClosing(WindowEvent e) {
    }

  • Write XML using XPath

    Hi,
    I have a problem. I need to WRITE a XML using XPath.
    Supose that XPath String : "/clients/client/name"
    Equivalent XML :
    <clients>
    <client>
    <name></name>
    </client>
    <clients>
    Please, helpme ...
    The XPath Strings are dinamic, there are lot of combinations.
    Is there an API (free ?) that support this ?
    Thankz

    Normally XPath is used for searching existing XML documents, not for creating new ones. So it's unlikely that anything exists to do what you ask. But not impossible, people do the strangest things. Have you searched Google?
    Of course you realize you can't use arbitrary XPath expressions here, for example what would you do with a predicate?

  • I need for a simple example of  reading a xml file using jdom

    Hello
    I have been looking for a simple example that uses Jdom to read am xml file and use the information for anything( ), and I just can't find one.since I'm just beggining to understand how things work, I need a good example.thanks
    here is just a simple cod for example:
    <xmlMy>
         <table>
              <item name="first" value="123" createdDate="1/1/90"/>
              <item name="second" value="456" createdDate="1/4/96"/>
         </table>
         <server>
              <property name="port" value="12345"/>
              <property name="maxClients" value="3"/>
         </server>
    </xmlMy>Dave

    Hi,
            FileInputStream fileInputStream = null;
            try {
                fileInputStream = new FileInputStream("my_xml_file.xml");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } finally{
                if (fileInputStream == null) return;
            SAXBuilder saxBuilder = new SAXBuilder();
            saxBuilder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
            Document document = null;
            try {
                document = saxBuilder.build(fileInputStream);
            } catch (JDOMException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (document == null) return;
            Element element = document.getRootElement();
            System.out.println(element.getName());
            System.out.println(element.getChild("table").getName());

  • Parsing an xml output of a ws-client using JDOM

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

  • How to get the "encoding" of a XML file using JDOM

    As in XML file, <?xml version="1.0" encoding="UTF-8" ?> indicates the encoding of this file
    while using JDOM to parse a XML file, how can I get the encoding type?
    thanx!!!

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • Searching for XML tags using Oracle Text

    I am using full text search to find documents based on a search text. It works fine for pdf, word documents, etc. However for XML documents, searching for a particular tag name does not find anything. Searching for text within tags works fine. Any thoughts?
    Edited by: miyer on Feb 21, 2011 6:25 PM

    Hi
    Try adding the following variable to ucm config.cfg and then see if a new xml checkin returns the result for FT search :
    TextIndexerFilterFormats=xml
    Save the file , restart UCM and then test .
    If the new checkin gets the results as expected then execute Collection Rebuild cycle to have the existing contents as well FT indexed to be searchable (for XML).
    Thanks
    Srinath

Maybe you are looking for

  • Need to POST data from a desktop client to a server.

    Hello all, it's been awhile since I've posted here, so I hope everyone has been doing well. I have cross posted this here java - Need to POST data from a client application to my server - Stack Overflow but no answers, and since SO has been extremely

  • Alert In Detail

    Hi Gurus, I need What is Alert why we need to use it. For simple F2F scenario also can i use alerts please dont post links. Explain me brief. When it requires exactly.

  • Device Library is missing in Profilemanager?

    Hello everybody, Who else has that experience? This was a complete new installation of OS X Server

  • OS Upgrade - Can Clustering work on two diff OS levels?

    I have WLS7.0sp2 installed on a pair of Solaris 8 boxes. We are upgrading the OS to 9 but the users don't want a down time on their Apps. Therefor, we can't take the whole app down and hit both boxes with the upgrade. My hunch is that if we upgrade o

  • Pavilion G6-2211sr Windows 7 64 drivers.

    Good day, There are no drivers in HP download section! I've just installed Windows 7 on my notebook, so I need the drivers pretty much. The only driver I've found is my ethernet Realtek Driver. Tried to download manuall AMD Display Driver (HD7000M se