XPATH problems

I use xpath to filter a xml document. When I use the xpath expressions from a main method everything works fine. But when I try to run my classes on through a servlet, the xpath returns nothing. I am using WSAD 5.0.1. Why would it not work on the server?

I am using the xalan api to access xpath features.

Similar Messages

  • Xindice - XPath Problem

    Hello,
    I've been using Xindice DB to manage XML files. Everything seemed to work well, but then i've run in some problems concering XPath queries.
    I have two "resources" (item1 and item2) for testing purposes in a collection named items. Both xml resources look like the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <assessmentItemType title="item1" timeDependent="false"
      identifier="item1" adaptive="false"
      xmlns:ns2="http://www.imsglobal.org/xsd/imslip_v1p0"
      xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
      xmlns:ns4="http://www.w3.org/1998/Math/MathML"
      xmlns:ns3="http://www.w3.org/1999/xlink" xmlns:ns5="http://www.w3.org/2001/XInclude">
      <itemBody id="itemBody1"/>
    </assessmentItemType>i (e.g.) want to get the id of the itemBody element, so i use the xpath query
    //itemBody/@id For a strange reason i don't get any results back.
    (I tested the query with the xpath trainer on http://www.write4food.orangegear.com/xptr.html to check if my xpath query was wrong, but it wasn't)
    If i just use
    /* as an xpath query, i get both resources (item1 and item2), which means that some xpath queries work.
    I'm fetching the data with the following code
    String query = "//itemBody/@id";
    XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    ResourceSet resultSet = service.query(query);
    ResourceIterator results = resultSet.getIterator();
    while (results.hasMoreResources()) {
         Resource res = results.nextResource();
         System.out.println((String) res.getContent());
    }Has anyone an explanation for this behavior?
    Thanks in advance!
    Figured it out: Forgot to add the namespaces information. Now everything works fine...
    XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
    service.setNamespace("ns-prefix", "ns-url");n10e
    Message was edited by:
    n10e

    Create a DocumentFragment node from the Xml node to unmarshall.
    Unmarshall document node with method unmarshal(org.w3c.dom.Node node)
    Document document;
    Node node;//Node to unmarshall
    DocumentFragment df=
    document.createDocumentFragment();
    df.appendChild(node);
    JAXBContext jc = JAXBContext.newInstance("");
    Unmarshaller u = jc.createUnmarshaller();
    u.unmarshal(df);

  • XPath problems (or XKMS problems)

    Hi,
    I'm working with XKMS (XML Signature) package, and i have found some annoying problem (maybe someone has found it too and has solved it).
    When i create an XPath expression to point the Signature element of my XML file and try to construct a verifier which will check that signature, i get the next error:
    com.verisign.xpath.XPathException: /dsig:Signature does not contain Signature, found null
    at com.verisign.xmlsig.Verifier.checkIs(Verifier.java:169)
    at com.verisign.xmlsig.Verifier.spawnNewDigVerifier(Verifier.java:157)
    at com.verisign.xmlsig.Verifier.<init>(Verifier.java:147)
    at Negociador.main(Negociador.java:315)My XML document starts as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
       <dsig:SignedInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
          <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
          <d:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:d="http://www.w3.org/2000/09/xmldsig#"/>
          <dsig:Reference URI="#ID0" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
             <dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
                <dsig:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
             </dsig:Transforms>
             <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
             <dsig:DigestValue>iso+E+Q/i19YDd8I+GFCWqIRA4s=</dsig:DigestValue>
          </dsig:Reference>
       </dsig:SignedInfo>
       <dsig:SignatureValue xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">Abfs4RrTcmXjhUa5pre+x/hxbfbNkljk79PKicTul76B6hX23v6/qWwxXHApH4yln67SYZMPELmWl3R4bq094UsEXiJPO8KdH25mDDpSDz76JG4a2Nmrn2PAIRjadGR9XhF+Mt4zSoYQqAy07fARCKhU9F36YBaoaVzti+nIa2o=</dsig:SignatureValue>
       <dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"/>
       <dsig:Object Id="ID0" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">The XPath expression i am using is "/dsig:Signature". I've talked with some pals and they think this expression should work.
    Could someone tell me what am i doing wrong?
    Thanks in advance. David.

    I've already solved that problem. Seems that xpath expression was correct, thanks anyway. The problem was that XKMS seems not to understand Java XML parsers, so it needs its own one to understand the doc structure.
    Does anyone know why does this happen? Is it a codification matter?
    Thanks again.

  • 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?

  • XPATH problem in Receiver Determination

    Hi Experts, I get stucked in the XPATH expression in the Receriver Determination(RD) :
    The input xml (default namespace settting) is like this :
    <?xml version="1.0" encoding="UTF-8" ?>
    <MT_XML_SENDER xmlns="http://test.com">
    <LAST_NAME>Bryant</LAST_NAME>
    <FIRST_NAME>Kobe10</FIRST_NAME>
    </MT_XML_SENDER>
    In the RD, I tried serveral XPATH expressions :
    /MT_XML_SENDER/LAST_NAME = Bryant
    /MT_XML_SENDER/LAST_NAME = "Bryant"
    /MT_XML_SENDER(LAST_NAME = \"Bryant\") EX
    But in every case, the PI always told me it could not find the receiver, I don't know what to do........
    (BTW,if I remove the condition, PI could work as desired, so it is 100% related to XPATH setting)
    Thanks very very much!!!!!
    Ray

    You probably noticed by yourself, but in the Condition Editor, it is necessary to set the namespace to a prefix and then create the XPath expression based on that prefix. i.e.
    /p1:MT_XML_SENDER/p1:LAST_NAME
    And on the prefix definitions, you set it to your namespace:
    p1 http://test.com
    Easiest way to do it is to go through the message structure, though, since it will fill the prefix automatically as per the definition in the message type in repository.
    Best regards,
    Henrique.

  • Import Schema leads to XPath Problems

    Hallo,
    When using a bpel process where I have some schema definitions included, I'm not able to access the contents of variables with XPath.
    <schema attributeFormDefault="unqualified"
    elementFormDefault="qualified"
    targetNamespace="http://service.achrist.net/price/"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://service.achrist.net/price/"
    xmlns:md="http://service.achrist.net/masterdata/">
    <import schemaLocation="MasterData.xsd" namespace="http://service.achrist.net/masterdata/"/>
    <element name="PriceServiceProcessRequest">
    <complexType>
    <sequence>
    <element name="item" type="md:Item"/>
    <element name="supplier" type="md:Supplier"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    The XPath expression in the BPEL process then crosses the two namespaces
    /client:PriceServiceProcessRequest/client:supplier/md:Name
    When using the expression inside an assign-activity, the bpel-engine claims
    "empty variable/expression result."
    A workaround for this is to copy paste the xsd types into the same namespace ... but rather ugly ...
    What is wrong with the imports ?

    Hello,
    I found one solution:
    Changing the way how elements are created to:
    <element name="PriceServiceProcessRequest">
              <complexType>
                   <sequence>
                        <element ref="md:ItemElement"/>
    <element ref="md:SupplierElement"/>
                   </sequence>
              </complexType>
         </element>
    ... now it works as expected...
    André

  • Xpath problems...please help

    Hi:
    i m new to xpath. i am trying to use xpath to select data from xhtml.Can i know how can select only one of the child ? take for example:
    - <table border="0" cellpadding="2" width="100%">
    + <tr>
    + <tr>
    + <tr>
    + <tr>
    - <tr>
    <td>Number of Kids</td>
    - <td>
    1
    - <small>
    Profile History
    </small>
    </td>
    </tr>
    + <tr>
    i only wan to get the info number of kids, so is 1. The xpath syntax that i put is ......tr[5]/td[2] but it give me all the children under td[2].....can anyone plz help?
    thank you

    hi emily_spt
    i m also doing the same project which converts html to xml in order to extract data.... from this website.:
    http://www-106.ibm.com/developerworks/web/library/wa-wbdm/
    i m not able to compile the programs XMLHelper.java and the other .
    can u plz illustrate the steps u had done to run the ..
    plzzzzzzzz reply as soon as possible

  • XMLBeans / XPath problem

    Hi,
    I'm getting java.lang.UnsupportedOperationException: This query is too complex to be processed. on the method call XmlObject[] h = doc.selectPath(queryText); I have googled the net looking for answers. I even downloaded XPath Explorer (Eclipse plugin) and my path works there for my XML file, so I'm stumped why it doesn't work in code. Please help!
    Here are the assets involved:
    The XML data file:
    <trx:box xmlns:trx="http://mysite.com/foo">
        <trx:transaction>
            <trx:id>100</trx:id>
            <trx:handler>Dog</trx:handler>
        </trx:transaction>
        <trx:transaction>
            <trx:id>200</trx:id>
            <trx:handler>Cat</trx:handler>
        </trx:transaction>
        <trx:transaction>
            <trx:id>300</trx:id>
            <trx:handler>Mouse</trx:handler>
        </trx:transaction>
    </trx:box>
    The XSD file:
    <xs:schema
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:trx="http://mysite.com/foo"
        targetNamespace="http://mysite.com/foo"
        elementFormDefault="qualified">
         <xs:element name="box">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="transaction" type="trx:transaction" minOccurs="1" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
       <xs:complexType name="transaction">
            <xs:sequence>
                <xs:element name="id" type="xs:string"/>
                <xs:element name="handler" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:schema>
    The .xsdconfig file
    <xb:config
        xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
        xmlns:trx="http://mysite.com/foo">
        <xb:namespace uri="http://mysite.com/foo">
            <xb:package>com.mysite.foo</xb:package>
        </xb:namespace>
    </xb:config>
    The code (don't yell, it's just proof of concept code):
        public Handler getHandler(String id) throws Exception
            Handler handler = null;
            BoxDocument doc = BoxDocument.Factory.parse(file);
            String nsText = "declare namespace trx='http://mysite.com/foo' ";
            String pathText = "$this/trx:box/trx:transaction[trx:id=\"" + id + "\"]/trx:handler";
            String queryText = nsText + pathText;
            System.out.println(queryText);
            XmlObject[] h = doc.selectPath(queryText);  // fails here with "This query is too complex to be processed"
            Class ch = Class.forName(h[0].xmlText());
            handler = (Handler)ch.newInstance();
            return handler;
        }

    java.lang.UnsupportedOperationException: This query
    is too complex to be processed. In the source for XMLBeans, (xmlbeans-1.0.3/src/xmlstore/org/apache/xmlbeans/impl/store/XqrlDelegate.javaspecifically), you'll see that the rocket scientist who created this code throws an UnsupportedOperationException if it can't find the method for executing the query. The message in the exception is clearly designed to mislead his enemies.
    Saxon (http://saxon.sourceforge.net/) has 1000x more robust XQuery support and they have documentation for embedding it in your app.
    HTH,
    -- /v\atthew

  • Dom4j xpath problem

    Hello all
    I have several methods in which I noticed strange behavior
    Here is the example:
    I create xpath as object because of performance, cause i use it on thousands of files
    XPath pathSpanPodzakonska = DocumentHelper.createXPath("//span[@class='palnk']");
    I found h4 element via xpath with relative path to h4 element...
    That works fine so far and founds h4 element that I need to.
    final Element elementH4= (Element) document.selectSingleNode("//h4[@id='someId']");
    Now i need to found some element inside that h4 tag
    but what I get is first element in document, outside h4 element !!!
    final Node nodeSpanPodzakonska = pathSpanPodzakonska.selectSingleNode(elementH4);
    That works same even if i write
    final Node nodeSpanPodzakonska = elementH4.selectSingleNode("//span[@class='palnk']");
    If I write code with absolute xpath that works fine when the span is directly inside of h4 but this isn't always case and cant depend on that.
    And more important have some other similar methods and want to clarify what happens in this xpath implementations and how can I use it in the best way.
    final Node nodeSpanPodzakonska = elementH4.selectSingleNode("span[@class='palnk']");
    Danilo Cubrovic

    Sorry. I will have to think about the XPath question in more detail.
    As to the side by side comparison: I meant of - open source HTML parsers
    http://java-source.net/open-source/html-parsers
    and also of XML frameworks that support XPath (such as DOM4j vs XOM).
    I am going to try HTMLParser with XOM, as I have, in informal speed testing, seen HTMLParser to be quite fast compared to others.
    The reason I would like to have speed is that I am working on a Web automation toolkit:
    www.mkosh.com
    and it looks like I will be re-parsing the entire tree after many Javascript commands.
    I would like to make this as speedy as possible. HTMLParser seems to win hands down, although if it does not work with real world HTML, that could be an issue.
    I will have to test.
    Thank you so much
    Misha

  • XPath Expression Problem

    Hi again,
    still a newb and stillsomequestions, but hope dies at last :)
    I want to extract values from a xml file which is stored in a table.
    i have the following code:
    COLUMN div DEFAULT
    SELECT extract(value(x), '//DIV/@ ID = ''FXAC93006ENC.0001.01.00''/text()').getStringVal() AS div
    FROM versuch2 x;
    With this code ive got the following Error Message: ORA:31012: Not supported XPath Statement.
    I tried this XPath statement in SlyXML and got a boolean:true result, so i think its not a xpath problem.
    Isthere a syntax problem?
    Thx for help!

    The correct syntax for fetching attributes is different from what you did.
    Not sure which syntax is the standard, but the Oracle Version seems more intuitive (too me). Why? Because an attribute is on the same hierachy level of the xml tag and therefore should not be queried with an additional /.
    SQL> with versuch2 as (select xmltype('<doc><div id="FXAC93006ENC.0001.01.00">Test</div></doc>') xmlcol from dual)
      2  SELECT extract(xmlcol, '//div[@id="FXAC93006ENC.0001.01.00"]/ text()').getStringVal() AS div
      3  FROM versuch2 x;
    DIV
    Test
    SQL>
    SQL> btw: W3C XPath Syntax stuff: http://www.w3.org/TR/xpath#predicates
    Message was edited by:
    Sven W.

  • XPath - limited logical operators?

    Hi out there!
    Currently I am experiencing an XPath problem, evaluating an XML file with it.
    Imagine I got an XML file like this:
    <xml? version="1.0" encoding="UTF-8"?>
    <OverallSet>
    <Set1>
    <group_of_fields>
    <requesting_component_command>WUZ</requesting_component_command>
    <request_identifier>WUZ</request_identifier>
    <request_status_indicator>APP</request_status_indicator>
    <mission_number>4bubu </mission_number>
    <complying_component_command>PROGRZLW</complying_component_command>
    <revised_priority>5</revised_priority>
    <comment_abbreviated>NONE</comment_abbreviated>
    </group_of_fields>
    </Set1>
    <Set2>
    <requesting_component_command>WUZ</requesting_component_command>
    <request_identifier>WUZ</request_identifier>
    <request_status_indicator>APP</request_status_indicator>
    <mission_number>55</mission_number>
    <complying_component_command>PROGRZLW</complying_component_command>
    <revised_priority>4</revised_priority>
    <comment_abbreviated>NONE</comment_abbreviated>
    </Set2>
    </OverallSet>
    Using XPath i would like to get a Node back, not a boolean value. The Evaluations works fine for the following expression wiht any value:
    //child::*[name() = 'mission_number and starts-with(descendant-or-self::*,'4') and contains(descendant-or self::*,'bubu') or name()='revised_priority' and starts-with(descendant-or-self::*,'45') and contains(descendant-or-self::*,'')]/parent::*
    as soon, as i put in another AND condition, i get no result anymore - no matter which way i try. May it be name() = 'request_identifier' within the brackets, concatenated with an AND, or may it be as stand alone expression like this [name()='request_identifier'].
    So my question is just if there is a certain limit to the logical expressions, and how to put in another AND condition. Do i miss something? Any suggestions welcome!
    Thanks for paying attention!
    Regards, Jens

    Having created the XML files with the XML Spy, i use the XPath evaluation option of the tool itself. Just recognized some inconsistencies and getting confused quite frequently. But the expression should work in any case - shouldnt it?

  • Will the next build support loading from a string correctly?

    Several weeks ago I posted a topic entitled: setDataFromDoc
    and XPath problem
    It dealt with restrictions when using an XML String to
    populate a dataset rather than using a URL.
    The simplest way of seeing what fails is to modify the RSS
    demo to use a string.
    The "features" area of the display doesn't then work. I've
    tried setting observers but this doesn't work.
    The topic has dropped off the forum without an answer.
    Jeremy Brookfield

    Hi Jeremy,
    I replied to your original post since that is where all the
    details of your problem were.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1229901
    --== Kin ==--

  • Group inside another group

    Hi!
    I need some help with the extraction of the following XML. I have a group inside another group and I'm no getting to extract the xNome and vComp elements. How can I do this? I've tried the XMLSequence, but I think I'm no using the right xPath.
    <infComp>
    <chave>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</chave>
    <vPresComp>
    <compComp>
    <xNome>NomeA1</xNome>
    <vComp>111.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeA2</xNome>
    <vComp>222.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeA3</xNome>
    <vComp>333.00</vComp>
    </compComp>
    </vPresComp>
    </infComp>
    <infComp>
    <chave>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</chave>
    <vPresComp>
    <vTPrest>500.00</vTPrest>
    <compComp>
    <xNome>NomeB1</xNome>
    <vComp>111.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeB2</xNome>
    <vComp>222.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeB3</xNome>
    <vComp>333.00</vComp>
    </compComp>
    </vPresComp>
    </infComp>
    Thanks!

    Got it! (based on the Michaels2 answer to "XPath problem."... thanks Michaels2).
    WITH t AS(
    SELECT XMLTYPE('<inf>
    <infComp>
    <chave>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</chave>
    <vPresComp>
    <compComp>
    <xNome>NomeA1</xNome>
    <vComp>111.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeA2</xNome>
    <vComp>222.00</vComp>
    </compComp>
    </vPresComp>
    </infComp>
    <infComp>
    <chave>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</chave>
    <vPresComp>
    <vTPrest>500.00</vTPrest>
    <compComp>
    <xNome>NomeB1</xNome>
    <vComp>111.00</vComp>
    </compComp>
    <compComp>
    <xNome>NomeB2</xNome>
    <vComp>222.00</vComp>
    </compComp>
    </vPresComp>
    </infComp>
    </inf>') xml
    FROM Dual)
    SELECT EXTRACTVALUE(x.column_value,'infComp/chave') AS chave,
    EXTRACTVALUE(y.column_value,'compComp/xNome') AS xNome,
    EXTRACTVALUE(y.column_value,'compComp/vComp') AS vComp
    FROM t t,
    TABLE(XMLSequence(t.xml.extract('//infComp'))) x,
    TABLE(XMLSequence(x.extract('//compComp'))) y
    /

  • Problem retrieving a list of values with XPATH

    Hi,
    I am trying to get a list of all 'Fields' (under the SubscriptionList -> EconomicIndicator -> Code) which have 'Provider' =DJ.
    I am using the below xpath expression. But It is not working. I tried other variations but none of them return mulitple items.
    Can some one please tell me if Iam missing something.
                   XPathExpression xPathExpression= xpath.compile("/SubscriptionList/EconomicIndicator[*]/Code[Provider=DJ]/Fields");
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
              System.out.println(element.getNodeValue());
    <?xml version="1.0" encoding="UTF-8"?>
    <SubscriptionList>
    <DefaultEconomicIndicatorName>US ADP Employment Change</DefaultEconomicIndicatorName>
    <!--GE IFO - Business Climate-->
    <EconomicIndicator>
    <Name>GE IFO - Business Climate</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-22T03:50:00</StartDate>
    <EndDate>2007-06-22T04:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEBUSS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    </EconomicIndicator>
    <!--GE Producer Prices (MoM)-->
    <EconomicIndicator>
    <Name>GE Producer Prices (MoM)</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-20T01:50:00</StartDate>
    <EndDate>2007-06-20T02:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEPPI=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Trends - Orders</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIO=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Distributive - Trades</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--US Unit Labor Costs-->
    <EconomicIndicator>
    <Name>US Unit Labor Costs</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-09-06T08:20:00</StartDate>
    <EndDate>2007-09-06T08:40:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>USLCTS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    </EconomicIndicator>
    </SubscriptionList>

    Hi DrClap,
    I have a similar problem again. This time I am trying to extract a list of values from a xsd. Below is the code that I am using.
              try{
                   djxsd = new FileInputStream("djei-3.1.xsd");
                   XPathFactory factory = XPathFactory.newInstance();
                   XPath xpath = factory.newXPath();
                   SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
                   xpath.setNamespaceContext(nsContext);
                   nsContext.addNamespace("xs", "http://www.w3.org/2001/XMLSchema");
                   nsContext.addNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
                   +//String exp = "//xs:element/@name/text()";+               
    String exp = "/xs:schema/xs:group/xs:sequence/xs:element";
                   XPathExpression xPathExpression= xpath.compile(exp);
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
                   FileOutputStream outputfile = new FileOutputStream("log.txt");
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
                   String output = element.getTextContent().trim();
                   if(output.length() > 0)
                        outputfile.write(output.getBytes());
                        //System.out.println(output);
    Highlighted in Itlalics is the actual expression that I want to use. For some reason this is not working .. it returns nothing.
    The other expression works. Please let me know if there is anything wrong with the expression.
    THE XSD FILE
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified">
         <xs:element name="DJEconomicIndicator">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:group ref="allgroup"/>
                   </xs:sequence>
                   <xs:attributeGroup ref="TopGrp-Attributes"/>
              </xs:complexType>
         </xs:element>
         <xs:group name="allgroup">
              <xs:sequence>
                   <!-- ==================== CPI ========================== -->
                   <xs:element name="US_CPI_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Unrounded==================== -->
                   <xs:element name="US_CPI_Unrounded_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI UnRounded</xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Core Index==================== -->
                   <xs:element name="US_CPI_Core_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_Core_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>

  • Problem in xpath reading

    hi to all,
    Iam using javax.xml.xpath.XPath to parse and read the xml file. It is working fine in java 1.5 version. but i want the same requirement in java 1.4. When iam using same code in java 1.4 it is throwing exceptions. Iam giving the code....
    First of all iam creating XPathReader class for xpath parsing and reading.
    import java.io.IOException;
    import javax.xml.XMLConstants;
    import javax.xml.namespace.QName;
    import javax.xml.parsers.*;
    import javax.xml.xpath.*;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    public class XPathReader {
    private DocumentBuilder documentBuilder=null;
    private Document xmlDocument;
    private XPath xPath;
    public XPathReader() {
    initObjects();
    private void initObjects(){
    try {
    documentBuilder= DocumentBuilderFactory.
    newInstance().newDocumentBuilder();
    xPath = XPathFactory.newInstance().
    newXPath();
    }catch (Exception ex) {
    ex.printStackTrace();
    public void parse(String filename){
    try {
    xmlDocument=documentBuilder.parse(filename);
    } catch (Exception e) {
    e.printStackTrace();
    public Object read(String expression,
    QName returnType){
    try {
    XPathExpression xPathExpression =
    xPath.compile(expression);
    return xPathExpression.evaluate
    (xmlDocument, returnType);
    } catch (XPathExpressionException ex) {
    ex.printStackTrace();
    return null;
    In another class iam just creating object of XPathReader
    XPathReader reader= new XPathReader();
    reader.parse(....xml file path that which u want to parse......);
    String expression = ....
    NodeList rootNode = (NodeList)reader.read(expression,XPathConstants.NODESET);
    here generally i will get NodeList object...
    this code works fine in java 1.5
    but it is showing exceptions in 1.4 as...
    java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFctory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom
    at javax.xml.xpath.XPathFactory.newInstance(Unknown Source)
    I think XPathFactory is not in the 1.4. So, is there any alternative to overcome the above problem?
    if any buddy knows please help me...
    thanks to one and all...
    Edited by: [email protected] on May 7, 2008 4:36 AM

    You need to post the code so we can help

Maybe you are looking for

  • I want to see the august data.Hw?

    In manage data target we have only october and september requist ids are there . but i want to see august data how? please help me.

  • Adobe Reader Startup Error (Internal Error Occurred)

    I've been using adobe reader X without a problem for a long time, until suddenly one day it started poping up a message "An internal error occurred" (marked with a red X), every time I try to run it or open a pdf file. The error pops up even when win

  • Regarding Barcode Type....

    Hi friends...      How can I get the information about the attributes of different barcode types   used in Smartforms? Kindly Suggest me the solution for this query??? Points will be rewarded to the useful answer... Thanx, Rahul.

  • Is it possible to start slideshow from current picture?

    Hi, is it possible to start slideshow from current picture? Slideshow in Aperture always start from first picture in album. There is possibility to select bunch of images and than start slideshow and slideshow will use only selected pictures but this

  • Cannot import images

    I have been looking around this forum for a similar question but i haven't found anything that corresponds to my needs... Ever since i have partitioned my drive with bootcamp, I can no longer import any images into iphoto! it comes up with the an err