Java XML Parser v2 xpath problem

I have a lot of trouble using the xpath functionality. I want to get the name of different elements. I'm using some xpath expressions which in my opinion should work (see http://www.w3.org/TR/xpath ), but they don't. I'm calling XMLNode.selectSingleNode.
For example :
/*/name()
name(/*[1])
name(/*)
name()
I've tried those with Saxon and they do work. Using the Oracle implementation an exception is thrown on most expressions. So what's wrong here?
Bye,
Jan

Consider this example
--- Test.java -----
import java.io.*;
import javax.xml.transform.sax.SAXSource;
import net.sf.saxon.sxpath.*;
import oracle.xml.parser.v2.*;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
public class Test
public Test() {
try {
DOMParser domParser = new DOMParser();
domParser.parse(new FileReader("test.xml"));
XMLDocument document = domParser.getDocument();
InputSource is = new InputSource(new File("test.xml").toURL().toString());
SAXSource source = new SAXSource(is);
testXPathOracle(document,"count(//*)");
testXPathOracle(document,"name(/*)");
testXPathOracle(document,"name(/root)");
testXPathOracle(document,"/*/name()");
testXPathSaxon(source,"count(//*)");
testXPathSaxon(source,"name(/*)");
testXPathSaxon(source,"name(/root)");
testXPathSaxon(source,"/*/name()");
} catch(Exception e) {
System.out.println(e.getMessage());
public void testXPathOracle(XMLNode context, String xpath) {
try {
Node node = context.selectSingleNode(xpath);
System.out.println(node.getNodeValue());
} catch(Exception e) {
System.out.println(e.getMessage());
public void testXPathSaxon(SAXSource source, String xpath) {
try {
XPathEvaluator xpe = new XPathEvaluator();
XPathExpression exp = xpe.createExpression(xpath);
Object object = exp.evaluateSingle(source);
System.out.println(object);
} catch(Exception e) {
System.out.println(e.getMessage());
public static void main(String[] args) {
Test test = new Test();
--- test.xml -----
<root>
     <element/>
</root>
Result is on my computer:
Unknown expression at EOF: (count(//*))[1].
Unknown expression at EOF: (name(/*))[1].
Unknown expression at EOF: (name(/root))[1].
Error in expression: '(/*/name())[1]'.
2
root
root
root
I think the xpath expressions are valid. So what's wrong?

Similar Messages

  • Java XML Parser:Null Pointer exception in EntityReader

    I got NullPointer Exception when trying to parse a XML file which
    is pointed by a net URL, (say "http://www..."). The code causing
    problem is like:
    parser.parse(new URL("http://www.../demo.xml"));
    the exception I got is:
    java.lang.NullPointerException
    java.lang.NullPointerException
    at oracle.xml.parser.EntityReader.initXMLInput(Compiled
    Code)
    at
    oracle.xml.parser.EntityReader.<init>(EntityReader.java:64)
    at oracle.xml.parser.XMLParser.parse(XMLParser.java:245)
    at DemoXML.main(DemoXML.java:47)
    The very same code works fine with a simple local file URL and we
    also know that the URL exists in correct in XML format because we
    can open the URL with IE5.
    Another question - where can we get the source for the Java XML
    Parser.
    null

    This bug has already been reported and will be fixed in our next
    release.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Fiona Lu (guest) wrote:
    : I got NullPointer Exception when trying to parse a XML file
    which
    : is pointed by a net URL, (say "http://www..."). The code
    causing
    : problem is like:
    : parser.parse(new URL("http://www.../demo.xml"));
    : the exception I got is:
    : java.lang.NullPointerException
    : java.lang.NullPointerException
    : at oracle.xml.parser.EntityReader.initXMLInput
    (Compiled
    : Code)
    : at
    : oracle.xml.parser.EntityReader.<init>(EntityReader.java:64)
    : at oracle.xml.parser.XMLParser.parse
    (XMLParser.java:245)
    : at DemoXML.main(DemoXML.java:47)
    : The very same code works fine with a simple local file URL and
    we
    : also know that the URL exists in correct in XML format because
    we
    : can open the URL with IE5.
    : Another question - where can we get the source for the Java
    XML
    : Parser.
    null

  • Java XMl parsing problems

    i have an xml sturcture as shown below:
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
    <cnv:roottag support="yes" destag="xfw:script">
    <cnv:addattr name="debug" value="no" />
    <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
    </cnv:roottag>
    <xsql:query support="yes" destag="xfw:genxml">
    <connection support="no" />
    <row-element support="yes" destag="row-name" />
    <rowset-element support="yes" destag="rowset-name" />
    <id-attribute support="no" />
    <tag-case support="no" />
    <null-indicator support="no" />
    <cnv:addattr name="debug" value="yes" />
    <cnv:addattr name="Attribute1" value="Value1" />
    </xsql:query>
    <xsql:no-rows-query support="no" child="no" />
    <responsedata support="no" child="yes" />
    <responsedata2 support="no" child="yes" />
    <page destag="page1" support="yes">
    <connection support="no" /> <debug destag="MyDebug" />
    <cnv:addattr name="tt" value="t1" />
    </page>
    <xsql:set-page-param support="yes" destag="setpageparam">
    <name destag="myname" />
    </xsql:set-page-param>
    <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
    <name destag="mylocalname" />
    </xsql:set-page-param-local>
    </cnv:conversion>
    I want this xml to be validated by the dom parser which i had done and its showing it as valid XML.
    If there are any repeating tags like:
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
    <cnv:roottag support="yes" destag="xfw:script">
    <cnv:addattr name="debug" value="no" />
    <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
    </cnv:roottag>
    <xsql:query support="yes" destag="xfw:genxml">
    <connection support="no" />
    <row-element support="yes" destag="row-name" />
    <rowset-element support="yes" destag="rowset-name" />
    <id-attribute support="no" />
    <tag-case support="no" />
    <null-indicator support="no" />
    <cnv:addattr name="debug" value="yes" />
    <cnv:addattr name="Attribute1" value="Value1" />
    </xsql:query>
    <xsql:no-rows-query support="no" child="no" />
    <responsedata support="no" child="yes" />
    <responsedata2 support="no" child="yes" />
    <page destag="page1" support="yes">
    <connection support="no" /> <debug destag="MyDebug" />
    <cnv:addattr name="tt" value="t1" />
    </page>
    <xsql:set-page-param support="yes" destag="setpageparam">
    <name destag="myname" />
    </xsql:set-page-param>
    <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
    <name destag="mylocalname" />
    </xsql:set-page-param-local>
    </cnv:conversion>
    </cnv:conversion>
    or like this....................
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
    <cnv:roottag support="yes" destag="xfw:script">
    <cnv:addattr name="debug" value="no" />
    <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
    </cnv:roottag>
    <cnv:roottag support="yes" destag="xfw:script">
    <cnv:addattr name="debug" value="no" />
    <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
    </cnv:roottag>
    <xsql:query support="yes" destag="xfw:genxml">
    <connection support="no" />
    <row-element support="yes" destag="row-name" />
    <rowset-element support="yes" destag="rowset-name" />
    <id-attribute support="no" />
    <tag-case support="no" />
    <null-indicator support="no" />
    <cnv:addattr name="debug" value="yes" />
    <cnv:addattr name="Attribute1" value="Value1" />
    </xsql:query>
    <xsql:no-rows-query support="no" child="no" />
    <responsedata support="no" child="yes" />
    <responsedata2 support="no" child="yes" />
    <page destag="page1" support="yes">
    <connection support="no" /> <debug destag="MyDebug" />
    <cnv:addattr name="tt" value="t1" />
    </page>
    <xsql:set-page-param support="yes" destag="setpageparam">
    <name destag="myname" />
    </xsql:set-page-param>
    <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
    <name destag="mylocalname" />
    </xsql:set-page-param-local>
    </cnv:conversion>
    My java code is shown below :
    import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.*;
    public class sample2
    public void processXML(String path)
    File docFile=new File(path);
    Document doc=null;
    try
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance(); DocumentBuilder db=dbf.newDocumentBuilder();
    doc=db.parse(docFile);
    catch(IOException ioe)
    System.out.println("cant find file");
    catch(Exception e)
    System.out.println("Error has occured");
    Element root=doc.getDocumentElement();
    NodeList children=root.getChildNodes();
    StringBuffer sbuf=new StringBuffer();
    for(Node child=root.getFirstChild(); child!=null; child=child.getNextSibling())
    if(child.getNodeType()==child.TEXT_NODE) sbuf.append(child.getNodeValue()) ;
    else if(child.getNodeType()==child.ELEMENT_NODE) if(child.getChildNodes()!=null)
    getnodes(child, sbuf);
    public void getnodes(Node Child, StringBuffer sbf)
    NodeList children=Child.getChildNodes();
    if(children.getLength() > 0)
    System.out.println(children.getLength() + Child.getNodeName());
    for(Node child=Child.getFirstChild(); child!=null;child=child.getNextSibling())
    if(child.getNodeType()==child.TEXT_NODE) sbf.append((child.getNodeValue()).trim());
    else if(child.getNodeType()==child.ELEMENT_NODE)
    if(child.getChildNodes()!=null)
    getnodes(child, sbf); sbf.append(";");
    public static void main(String[] args)
    testxml txml=new testxml();
    txml.processXML("E:\\Naresh\\conversion_fxsql.xml");
    can any body tell me how to validate the repeating tags (as i dont have dtd for this xml )with the given code.... if any one of the tags are repeating it should raise an exception thats its not a valid xml
    Thanks in advance
    Regards
    Bunny

    I suggest you create a DTD or a XSD file to validate your existing XML document, because it's easier that i looks, and will help in future changes.
    If you want to do it in Java code, you can always store each line of the XML file in some form (like a class) in a List, and the each time you read a line, you compare with everything on the list.
    But don't go that way, make a XSD file

  • Java XML parsing with Xerces in Eclipse using Oxygen problem

    Hey everybody,
    Got me a stickler of a prob here and i'm hoping sum one out there will be able to help. I am trying to parse XML files into JDom objects so i can use them in the rest of my project with ease, but i'm having trouble parsing anything wihtout getting these errors
    Error: URI = /filelocat/personal-schema.xml", Line = "3", : Document root element "personnel", must match DOCTYPE root "null".
    Error: URI = /filelocat/personal-schema.xml", Line = "3", : Document is invalid: no grammar found.
    Error: URI = /filelocat/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
    Error: URI = /filelocat/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
    The are the files are ones that come in Oxygens samples folder so they should be correct. The code is as follows
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setValidating(true);
    SchemaFactory sFact = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
    Schema schema = sFact.newSchema(schemaFile);
    factory.setSchema(schema);
    DocumentBuilder dommer = factory.newDocumentBuilder();          
    Document doco = dommer.parse(xmlFile.getAbsolutePath());None of these errors appears to be fatal, i can still use the doco object and extract the information i require, but i want to understand where the errors are coming from. There must be a parser setting or sumthing i've missed somewhere.
    Can anyone help?
    Any ideas/surgestions/critique welcome.
    Tom

    When we are parsing this xml: "<CustomerInfo><VCID/>77888</CustomerInfo>".
    See comments in following code.
    Element docEle = d.getDocumentElement(); // Returns "CustomerInfo" element node.
    NodeList childNodes2 = docEle.getChildNodes(); // Returns two nodes: <VCID/> element node and 77888 text node.
    Node item4 = childNodes2.item( 0 ); // First node (element node) of the "CustomerInfo" tag. <VCID/>
    Node item5 = childNodes2.item( 1 ); // Second node (text node) of the "CustomerInfo" tag is 77888. Look this text is not child of VCID, it's second child node of "CustomerInfo" tag.
    NodeList childNodes3 = item4.getChildNodes(); // Returns null because <VCID/> node is empty.
    String nodeValue = item5.getNodeValue(); // Returns 77888 ( text node ).               Regards,
    S&#322;awomir Wojtasiak

  • JAVA XML Parsing

    i have an xml sturcture as shown below:
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
         <cnv:roottag support="yes" destag="xfw:script">
              <cnv:addattr name="debug" value="no" />
              <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
         </cnv:roottag>
         <xsql:query support="yes" destag="xfw:genxml">
              <connection support="no" />
              <row-element support="yes" destag="row-name" />
              <rowset-element support="yes" destag="rowset-name" />
              <id-attribute support="no" />
              <tag-case support="no" />
              <null-indicator support="no" />
              <cnv:addattr name="debug" value="yes" />
              <cnv:addattr name="Attribute1" value="Value1" />
         </xsql:query>
         <xsql:no-rows-query support="no" child="no" />
         <responsedata support="no" child="yes" />
         <responsedata2 support="no" child="yes" />
         <page destag="page1" support="yes">
              <connection support="no" /> <debug destag="MyDebug" />
              <cnv:addattr name="tt" value="t1" />
         </page>
         <xsql:set-page-param support="yes" destag="setpageparam">
              <name destag="myname" />
         </xsql:set-page-param>
         <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
              <name destag="mylocalname" />
         </xsql:set-page-param-local>
    </cnv:conversion>
    I want this xml to be validated by the dom parser which i had done and its showing it as valid XML.
    If there are any repeating tags like:
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
         <cnv:roottag support="yes" destag="xfw:script">
              <cnv:addattr name="debug" value="no" />
              <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
         </cnv:roottag>
         <xsql:query support="yes" destag="xfw:genxml">
              <connection support="no" />
              <row-element support="yes" destag="row-name" />
              <rowset-element support="yes" destag="rowset-name" />
              <id-attribute support="no" />
              <tag-case support="no" />
              <null-indicator support="no" />
              <cnv:addattr name="debug" value="yes" />
              <cnv:addattr name="Attribute1" value="Value1" />
         </xsql:query>
         <xsql:no-rows-query support="no" child="no" />
         <responsedata support="no" child="yes" />
         <responsedata2 support="no" child="yes" />
         <page destag="page1" support="yes">
              <connection support="no" /> <debug destag="MyDebug" />
              <cnv:addattr name="tt" value="t1" />
         </page>
         <xsql:set-page-param support="yes" destag="setpageparam">
              <name destag="myname" />
         </xsql:set-page-param>
         <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
              <name destag="mylocalname" />
         </xsql:set-page-param-local>
    </cnv:conversion>
    </cnv:conversion>
    or like this....................
    <cnv:conversion xmlns:cnv="urn:ssis-conv" xmlns:xsql="urn:oracle-xsql">
         <cnv:roottag support="yes" destag="xfw:script">
              <cnv:addattr name="debug" value="no" />
              <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
         </cnv:roottag>
    <cnv:roottag support="yes" destag="xfw:script">
              <cnv:addattr name="debug" value="no" />
              <cnv:addattr name="xmlns:xfw" value="urn:scb-xfw-v2" />
         </cnv:roottag>
         <xsql:query support="yes" destag="xfw:genxml">
              <connection support="no" />
              <row-element support="yes" destag="row-name" />
              <rowset-element support="yes" destag="rowset-name" />
              <id-attribute support="no" />
              <tag-case support="no" />
              <null-indicator support="no" />
              <cnv:addattr name="debug" value="yes" />
              <cnv:addattr name="Attribute1" value="Value1" />
         </xsql:query>
         <xsql:no-rows-query support="no" child="no" />
         <responsedata support="no" child="yes" />
         <responsedata2 support="no" child="yes" />
         <page destag="page1" support="yes">
              <connection support="no" /> <debug destag="MyDebug" />
              <cnv:addattr name="tt" value="t1" />
         </page>
         <xsql:set-page-param support="yes" destag="setpageparam">
              <name destag="myname" />
         </xsql:set-page-param>
         <xsql:set-page-param-local support="yes" destag="Myset-page-param-local">
              <name destag="mylocalname" />
         </xsql:set-page-param-local>
    </cnv:conversion>
    or any row is being repeated it not a valid XML....
    my java code is :
    My java code is shown below :
    import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.*;
    public class sample2
         public void processXML(String path)
              File docFile=new File(path);
              Document doc=null;
              try
                   DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();                     DocumentBuilder db=dbf.newDocumentBuilder();
                   doc=db.parse(docFile);
              catch(IOException ioe)
                   System.out.println("cant find file");
              catch(Exception e)
                   System.out.println("Error has occured");
              Element root=doc.getDocumentElement();
              NodeList children=root.getChildNodes();
              StringBuffer sbuf=new StringBuffer();
              for(Node child=root.getFirstChild(); child!=null; child=child.getNextSibling())
                   if(child.getNodeType()==child.TEXT_NODE)                sbuf.append(child.getNodeValue()) ;
                   else if(child.getNodeType()==child.ELEMENT_NODE)                if(child.getChildNodes()!=null)
                   getnodes(child, sbuf);
    public void getnodes(Node Child, StringBuffer sbf)
         NodeList children=Child.getChildNodes();
         if(children.getLength() > 0)
              System.out.println(children.getLength() + Child.getNodeName());
         for(Node child=Child.getFirstChild(); child!=null;child=child.getNextSibling())
              if(child.getNodeType()==child.TEXT_NODE) sbf.append((child.getNodeValue()).trim());
         else if(child.getNodeType()==child.ELEMENT_NODE)
         if(child.getChildNodes()!=null)
              getnodes(child, sbf); sbf.append(";");
    public static void main(String[] args)
         testxml txml=new testxml(); txml.processXML("E:\\Naresh\\conversion_fxsql.xml");
    can any body tell me how to validate the repeating tags with the given code.... if any one of the tags are repeating it should raise an exception thats its not a valid xml
    Thanks in advance
    Regards
    Bunny

    The first problem about this document is that it contains a space at the very first position whereas <?xml... must appear at the very beginning of a document. I think this was the cause of the parsing fault.
    Also you have a dash before the root element of the document, which is illegal.

  • Java + XML = parsing error

    I am recieving this message when application is parsing an xml file, but only in specific cases which i can't determinate. Seems like xml file structure is the same in the cases when all is ok, and when i get that message below. I dont use any schema.
    DefaultValidationEventHandler: [ERROR]: Unexpected element {}:ALRT
    Location:
    javax.xml.bind.UnmarshalException: Unexpected element {}:ALRT
    My xml file structure in most occasions is like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <SHOP_answer id="shop_response">
    - <WAREHOUSE>
    <Warehouse_client Id="C1">Gate</Warehouse_client>
    <Warehouse_server Id="TS1">SHOP SERVER</Warehouse_server>
    <Warehouse_transaction Id="0">Test</Warehouse_transaction>
    <Warehouse_language Id="LV">Latvieshu</Warehouse_language>
    <Warehouse_currency Id="EUR">Euro</Warehouse_currency>
    </WAREHOUSE>
    - <STORE>
    - <ITM id="1">
    - <GDS nbr="100">
    <gds_descr>live animals</gds_descr>
    <gds_ind>3</gds_ind>
    </GDS>
    - <LOC>
    <loc_area_id>NL</loc_area_id>
    <loc_area_descr>Nid</loc_area_descr>
    </LOC>
    - <EMA id="1">
    <EMA_id code="3">ABC</EMA_id>
    - <PRICE id="026">
    - <Price_element>
    <Price_b>0.42</Price_b>
    <Price_r>0.418</Price_r>
    <Price_a>0.18</Price_a>
    <bee_code>271</bee_code>
    </Price_element>
    - <Price_element>
    <Price_b>0.00</Price_b>
    <Price_r>2.227</Price_r>
    <Price_a>0.00</Price_a>
    <bee_code>272</bee_code>
    </Price_element>
    </PRICE>
    </EMA>
    </ITM>
    </STORE>
    </SHOP_answer>

    The first problem about this document is that it contains a space at the very first position whereas <?xml... must appear at the very beginning of a document. I think this was the cause of the parsing fault.
    Also you have a dash before the root element of the document, which is illegal.

  • ORA-29534 when loading Java XML Parser

    Hi. I'm trying to install the Java and PL/SQL parsers into an 8i database, following the instructions in Steve Muench's O'Reilly book.
    It looks like loadjava is loading the classes, but when it tries to resolve them I get the ORA-29534 error for each class. We're running 8.1.5 on the database, and the parser is 2.0.10 (I think - I downloaded it from OTN today, and I'm installing the Java parser from the Java XDK not the PL/SQL XDK).
    Any help is appreciated.
    Thanks in advance,
    Craig Drabik
    Lead Programmer/Analyst
    Univeristy at Buffalo
    [email protected]

    That's 2.0.2.10 not 2.0.10
    -Craig
    null

  • Sizing DOM trees created by Oracle Java XML parser (v2)

    Hello,
    Has anyone seen/got any formulas that can be used to calculate the DOM tree memory requirements for a given XML document.
    My team has developed some software that, acts like an XSLT, and it runs out of memory for bigger documents. I am able to allocate more memory (usuing java -Xmx<larger figure>) to the process but it would be nice to go to my team leader and say that a file of a given structure would require so much memory.
    At the moment, we are guessing and using the Runtime.getRuntime().freeMemory() and Runtime.getRuntime().TotalMemory()
    to provide some very rough estimates.
    XSLTs wouldnt be able to do what we want. If I could give the team leader some figures then he may be able to justify converting the code to use JDOM instead of a DOM tree.
    Thanks in Advance.
    Mark Robbins

    Can you paste your java code here ? I assume, you must have tried type-casting.

  • JAVA XML DOM4J: Invalid XPath expression

    Hi everybody,
    I am not sure why I am getting an exception for this expression:
    Number count= document.numberValueOf("/NODE/SUBNODE/count(*)");
    Exception is:
    org.dom4j.InvalidXPathException: Invalid XPath expression:
    Thanks regards
    Mario

    Hello
    what about
    "count (/NODE/SUBNODE)" as xpath expression
    regards franz
    reward points if useful

  • XmlNode.selectSingleNode(String pattern) - Java xml parser v.2

    Hi,
    I cannot understand how this method is supposed to be used :(
    I use it so:
    xmlNode.selectSingleNode("element[@name='some_name']") and I don't get a node as a result although I know such node exists. What the format of the pattern argument is supposed to be? The documentation is quite poor on this topic :(

    Your syntax is 100% correct.
    If the current node that your "xmlNode" variable refers to is the <XXXX> element below:
    <XXX>
    <element name="some_name"/>
    </XXX>
    Then xmlNode.selectSingleNode("element[@name='some_name']") will select the <element> element child.

  • XML-Parser-Problem ? DataBindings.cpx

    Hello,
    Ok -I just will formulate my question somewhat different: It is possible that the XML-Parser has a Problem ? Please see the stuff below.
    I just got a warning:
    Project: D:\ORAJDev101320\jdev\mywork\LoginJSF\ViewController\ViewController.jpr
    D:\ORAJDev101320\jdev\mywork\LoginJSF\ViewController\src\login\DataBindings.cpx
    Warning(11,15): <Line 11, Column 15>: XML-24521: (Fehler) Element nicht abgeschlossen: 'Application'
    for the following xml file when compiling my sampe books (chapter9) code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Application xmlns="http://xmlns.oracle.com/adfm/application"
    version="10.1.3.40.66" id="DataBindings" SeparateXMLFiles="false"
    Package="login" ClientType="Generic">
    <pageMap>
    <page path="/home.jsp" usageId="homePageDef"/>
    </pageMap>
    <pageDefinitionUsages>
    <page id="homePageDef" path="login.pageDefs.homePageDef"/>
    </pageDefinitionUsages>
    </Application>
    After trying a little bit it turned out that the message disappears when
    the :
    Application xmlns="http://xmlns.oracle.com/adfm/application"
    is rewritten to
    Application xmlns="http://xmlns.oracle.com/adfm/Application"
    (Application with a upper first A)
    I have to point out that previously I did not by hand coding in this file.
    Is this a known issue.?
    And will/could these change do cause other/addition problems somewhere ?
    Andre
    Message was edited by:
    andreml
    null

    How about adding this tag <dataControlUsages/>? My JDev doesn't complain about your content.
    just my 2 cents
    --olaf                                                                                                                                                                                                                                               

  • Using XML parser in Java

    Hi,
    I would like to distribute the Java XML parser with my product (which does not include an Oracle database).
    Do you have an idea, if this can be done ?
    The license agreement is "for a single developer". My local reseller has no clue if I can use for free, or how much does it cost.
    Any idea ?

    Free runtime redistribution. visit the latest download page for the production version to see the verbage.

  • Create document with PL/SQL xml parser

    Hello,
    I'm trying to create a document with PL/SQL package xmldom on 8.1.7 and write to a file.
    The problem is that my file is empty when it's created.
    Can anyone send me an example of this simple problem or fullfill my example so it's works.
    As you understand I'm new in using XML. :)
    My example is:
    declare
    doc xmldom.DOMDocument;
    n xmldom.DOMNode;
    e xmldom.domelement;
    t xmldom.domtext;
    begin
    doc := xmldom.newdomdocument;
    t := xmldom.createtextnode(doc, 'ROOT');
    n := xmldom.makenode(t);
    doc := xmldom.makedocument(n);
    xmldom.writetofile(doc, 'd:\orant\xdk\plsql\demo\test.xml');
    end;
    Regards
    Hekan

    Your problem may be memory for the JavaVM. Remember, the PL/SQL
    parser uses the Java XML Parser APIs which run in a VM instance.
    Are you running Oracle 8i? If you are you can access our Java
    XML parser loaded in 8i's VM directly from your PL/SQL code.
    That is in fact how our PL/SQL Parser does it.
    Finally, we have no experience loading other XML Parsers into
    Oracle.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Premal Mehta (guest) wrote:
    : Hi,
    : I asked about his a few days back. Pl/SQL parser does not
    work
    : for XML files of size greater then 500Kb. You replied saying
    : that there were no such problem.
    : However whenever I try, either I get some exception or
    Pl/SQL
    : crashes due to memory error. I am clueless. Is there some
    : setting that I can do to get away with the problem? Please
    : guide...
    : Also, tell me about the alternatives.
    : Can I write code in Java and load these class filesin Oracle
    : and then reference these classes from Pl/SQL code. Can I load
    : any other parser for Java in Oracle.
    : Looking forward for help...
    : Premal.
    null

  • XML parser working with MediaWiki API

    I have a little helper for a MediaWiki server. It intended to work the following way:
    Client side [GWT] &#8592;rpc&#8594; Server side [GWT] — JWBF &#8592;http&#8594; MediaWiki API+
    GWT - Google Web Toolkit 2.0.4
    JWBF - Java Wiki Bot Framework 1.3.2
    MediaWiki 1.16 XML
    JDK1.6.0_21
    GWT sends and receive utf-8 data between client and server well. But the second half fails to work with its own xml traffic.
    JWBF gets the xml file via HTTP (log4j logging):
    [DefaultClientConnection  ] Receiving response: HTTP/1.1 200 OK
    [headers                  ] << HTTP/1.1 200 OK
    [headers                  ] << Date: Thu, 09 Sep 2010 17:36:34 GMT
    [headers                  ] << Server: Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.4
    [headers                  ] << X-Powered-By: PHP/5.2.4
    [headers                  ] << Cache-Control: private
    [headers                  ] << Vary: Accept-Encoding
    [headers                  ] << Content-Length: 1177
    [headers                  ] << Keep-Alive: timeout=5, max=95
    [headers                  ] << Connection: Keep-Alive
    [headers                  ] << Content-Type: text/xml; charset=utf-8
    [DefaultRequestDirector   ] Connection can be kept alive for 5000 ms
    [wire                     ] << "<?xml version="1.0"?><api><query><pages><page pageid="103" ns="0" title="Bronenosets Potyomkin"><revisions><rev revid="503" parentid="502" user="Anton" timestamp="2010-09-09T09:26:34Z" comment="Undo revision 502" xml:space="preserve">[\n]"
    [wire                     ] << "The Battleship Potemkin ([0xd0][0x91][0xd1][0x80][0xd0][0xbe][0xd0][0xbd][0xd0][0xb5][0xd0][0xbd][0xd0][0xbe][0xd1][0x81][0xd0][0xb5][0xd1][0x86] [0xc2][0xab][0xd0][0x9f][0xd0][0xbe][0xd1][0x82][0xd1][0x91][0xd0][0xbc][0xd0][0xba][0xd0][0xb8][0xd0][0xbd][0xc2][0xbb]) is a film.[\n]"
    [wire                     ] << "[\n]"
    [wire                     ] << "The Odessa Steps sequence editing.</rev></revisions></page></pages></query><query-continue><revisions rvstartid="502" /></query-continue></api>"
    [SingleClientConnManager  ] Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@dfb098And Java XML parser fails to understand this xml and returns the string as it was ISO-8859-1. After the xml bases a class with SAXBuilder, name in brackets, the one within "rev" element, becomes:
    БроненоÑ&#65533;ец «Потёмкин»while it should be
    &#1041;&#1088;&#1086;&#1085;&#1077;&#1085;&#1086;&#1089;&#1077;&#1094; «&#1055;&#1086;&#1090;&#1105;&#1084;&#1082;&#1080;&#1085;»The whole system (Apache, MediaWiki plus JWBF, GWT, client HTML) is set to utf-8, but Java parser (default settings) still does not agree.
    Dear specialists, where could be the error?

    The problem's been found thanks to DrClap ( [XML converted to string - encoding lost?|http://forums.sun.com/thread.jspa?threadID=610257] ).
    JWBF read the HTTP stream using system's default encoding:
           +Line 216 in jwbf-1.3.2-262\src\net\sourceforge\jwbf\core\actions\HttpActionClient.java+
    BufferedReader br = new BufferedReader(new InputStreamReader(res.getEntity().getContent()));From here the whole chain got the wrongly encoded string, including XML parser.
    So, the solution is to define the encoding explicitly:
    BufferedReader br = new BufferedReader(new InputStreamReader(res.getEntity().getContent(), "UTF-8"));Thank to the community.

  • XML parsing ideas

    Hi,
    I am beginning work on a new application in a week or so, and part of it includes parsing data from an XML file. I have been looking at the options for XML integration with Java and wondered if anyone could give me some recommendations?
    Apache have http://xml.apache.org/xerces2-j/index.html - their xerces java XML parser. Sun have http://java.sun.com/xml/xml_jaxp.html - JAXP. I reckon the JAXP implementation would be preferable, but does anyone have any recommendations? I am using the Sun JDK 1.3, the XML parsing will be server-side, speed is an issue as is complexity. I am afraid I have been given no indication of the size or shape of the XML files.
    Thanks in advance,
    Ciaran.

    Since you don't have much idea of the problem space, I'd recommend experimenting with them yourself. Advice has a short shelf-life, these things are changing rapidly.

Maybe you are looking for

  • How can I open a site in DW CS4?

    Hola I had been using GoLive for a long time, now I'm trying to learn  DW In Golive, when you make a site, the program automatically make a .site file with folders for everything. In DW CS4 I cannot find the .site file anywhere --I don't want to talk

  • Do I want to overwrite my copy of the local file?

    Is there any way to stop the ridiculous, pestering question everytime I open a file in Dreamweaver CS3? I already have a 3 second delay while I'm trying to edit my code. Could I possibly get rid of 1 of the obnoxious things on my list?

  • Doubt on Table Partitions

    hello, i am junior dba our company deals with health care products, in our project we have a USER REGISTRATION table,in which every user should register in that table before joining in the hospital. That table contains lakhs of records ,and we made d

  • Dell Inspiron 1525 - Sound and Xorg Conf

    Hey everyone, hope I'm posting this in the right forum. I have my arch install on an Inspiron 1525 as the title states. I have Xorg and OSS installed on it currently. I need to know two things: 1. I consulted the Arch Wiki for the laptop and it sugge

  • Facebook news feed issue

    Till yesterday Facebook news feeds were working fine . But this morning news feed stopped working and keeps giving this message "Facebook did not return any stories ". My network is fine and I even tried Facebook using browser it works fine. How to r