XPATH help

I'm trying to write a little game in Flash that uses XML for
persistent storage of questions and answers. Our e-learning
developers can then reuse the game in various e-learning courses
w/out having to do anything in Flash. I developed a "standard" XML
format for handling questions and answers (and some additional
stuff like hints and feedback), and used this XML format in a
JavaScript-based game w/out any trouble (using XPATH to get the
relevant data out of the XML file).
I'm having trouble getting the XPATH statements in
ActionScript to work however.
In JavaScript, I used statements like:
questionsArray[z]["theText"]=
questionNodes.item(z).selectSingleNode("theText").text;
questionsArray[z]["theHint"]=
questionNodes.item(z).selectSingleNode("hint").text;
, etc, where questionNodes is the XML containing all the
questions, to create an array of questions and answers.
When I try the same statements in ActionScript (using what I
think would be the correct ActionScript syntax), I always get null
results.
For example:
questionsArray[z]["theText"]=
XPathAPI.selectSingleNode(questionNodes.item[z], "theText");
questionsArray[z]["theHint"]=
XPathAPI.selectSingleNode(questionNodes.item[z], "hint");
For that matter, I can never get a trace to put out anything
when using item[ ] syntax. For example, the following is undefined:
trace (questionNodes.item[1]);
Basically what I'm trying to do is create an array from the
XML data, but I can't figure out how to "walk through" the XML data
as I can in JS.
Any ideas? I know the XML is loading properly because I have
some other XPATH statements that have worked..
Thanks for any advice! - Mike

You'll need to decide which node(s) you want to return as the result of whatever XPath expression you come up with. Then you'll need to write a suitable predicate which implements your requirements. Your rough example doesn't have enough information to produce an XPath expression.
XPath will return all nodes which satisfy that expression. And casting a nodeset to boolean results in true if the nodeset contains any nodes and false if it contains none.

Similar Messages

  • Xpath help please!!!

    This is the source XML file. The portion of interest only has been shown below.
    Now,i am trying to parse the DOM document that i could successfully generate out of this file, using XPath.
    I am only interested in the attributes and their values. Using the code that i wrote, i am able to get only the attributes but not their values. Can someone please modify the XPath expression that i need to use, to get the values also?
    The xpression tht i am using is:
    String xpathAttr = "//*[starts-with(name(), 'at')]";
    What do i need to add to this, if i need to get its corresponding chilnodes too ?
    Thanks!
    <Profile>
    <attribute name="%USER_ID%" >
    <value>
    wptest1
    </value>
    </attribute>
    <attribute name="%ORG_MEMBERSHIP%" >
    <value>
    OU=webUsers,OU=usersAndGroups,DC=company,DC=com
    </value>
    <attribute name="%FIRST_NAME%" >
    <value>
    wptest1
    </value>
    <attribute name="%MEMBER_OF%" >
    <values>
    <value>
    CN=group1,OU=Groups,OU=usersAndGroups,DC=company,DC=com
    </value>
    <value>
    CN=group2,OU=Groups,OU=usersAndGroups,DC=company,DC=com
    </value>
    </values>
    </attribute>
    </Profile>
    DomXpathRead.java follows below:
    import org.w3c.dom.*;
    import java.util.*;
    import com.wellpoint.TEWSClasses.Logger;
    public class DomXpathRead
         private static final String CRLF = System.getProperty("line.separator");
         private static String key = "";
         private static String value = "";
         private Hashtable elements = new Hashtable();
         private Document doc = null;
         public DomXpathRead(Document rootDoc)
              doc = rootDoc;
         public void parseDom()
              String xpathAttr = "//*[starts-with(name(), 'at')]";
              try {
                   // Get the matching elements
                   NodeList nodelist = org.apache.xpath.XPathAPI.selectNodeList(doc, xpathAttr);
                   // Process the elements in the nodelist
                   for (int i=0; i<nodelist.getLength(); i++)
                        // Get element
                        Element elem = (Element)nodelist.item(i);
                        if(elem.hasAttributes())
                             NamedNodeMap nm = elem.getAttributes();
                             for(int j=0; j<nm.getLength();j++)
                                  Attr attrib = (Attr)nm.item(j);
                                  Logger.Log(attrib.getValue()+":"+attrib.hasChildNodes()+Logger.CRLF);
                                  NodeList vList = attrib.getChildNodes();
                                  for(int k =0; k<vList.getLength();k++)
                                       Node val = vList.item(k);
                                       Logger.Log(":"+val.getNodeName()+":"+val.getNodeType()+Logger.CRLF);
              } catch (javax.xml.transform.TransformerException e)

    okay guys ..could get a handle on this!
    for public consumption, the XPath string that i used is:
    String xpathAttr = "//*[starts-with(name(), 'at')]/descendant-or-self::*";
    and this got me all the attributes and their asociated values!! it becomes so easy!

  • Xpath help needed

    Hi all.
    I'm totally stuck on what should(?) be a simple problem.
    We are provided with an external XML file which references a local(their local) schema etc.
    What I'd like to do is remove or update all the attributes passed in -
    the file starts as
    <?xml version="1.0" encoding="UTF-8" ?>
    <RegistrationMessage xmlns="http://www.dca.gov.uk/xmlschemas/libra" xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPersonalDetails" xmlns:bsa="http://www.govtalk.gov.uk/people/bs7666" xmlns:cor="http://www.govtalk.gov.uk/core" xmlns:fin="http://www.govtalk.gov.uk/financial/GDSCFinancialTypes" xmlns:org="http://www.govtalk.gov.uk/financial/OrganisationIdentifiers" xmlns:pds="http://www.govtalk.gov.uk/people/PersonDescriptives" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dca.gov.uk/xmlschemas/libra H:\General\General\XML-Files\LibraSchemas\FixedPenaltyOffice170504\DCA-Libra-FixedPenaltyRegistration-v0-3c.xsd" Flow="RegistrationsForTheCourt" Interface="LibraFixedPenaltyOffice" SchemaVersion="0.3c">
    <Registration>
    <CTOcode>ABC01C</CTOcode>
    etc.
    and I'd quite happily strip all the attributes except the namespace - we validate it against a registered schema later.
    I'm quite a beginner at XMLDB, but from my reading of XPATH I expected that
    '/RegistrationMessage[@*]' would select just the attributes, but xmlupdate or xmldelete seem to hit all of the file
    Can anyone suggest the correct way to hit just these attributes?
    Many thanks
    Malcolm

    Which version are you working with
    This works
    SQL> with XML as
      2  (
      3  select XMLTYPE(
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <RegistrationMessage xmlns="http://www.dca.gov.uk/xmlschemas/libra" xmlns:apd="http://www.govtalk.gov.uk/people/AddressAndPerso
    nalDetails" xmlns:bsa="http://www.govtalk.gov.uk/people/bs7666" xmlns:cor="http://www.govtalk.gov.uk/core" xmlns:fin="http://www.gov
    talk.gov.uk/financial/GDSCFinancialTypes" xmlns:org="http://www.govtalk.gov.uk/financial/OrganisationIdentifiers" xmlns:pds="http://
    www.govtalk.gov.uk/people/PersonDescriptives" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.d
    ca.gov.uk/xmlschemas/libra H:\General\General\XML-Files\LibraSchemas\FixedPenaltyOffice170504\DCA-Libra-FixedPenaltyRegistration-v0-
    3c.xsd" Flow="RegistrationsForTheCourt" Interface="LibraFixedPenaltyOffice" SchemaVersion="0.3c">
      6     <Registration>
      7             <CTOcode>ABC01C</CTOcode>
      8     </Registration>
      9  </RegistrationMessage>') as OBJECT_VALUE from dual
    10  )
    11  select deleteXML
    12         (
    13            object_value,
    14            '/RegistrationMessage/@*',
    15            'xmlns="http://www.dca.gov.uk/xmlschemas/libra"'
    16         )
    17    from XML
    18  /
    DELETEXML(OBJECT_VALUE,'/REGISTRATIONMESSAGE/@*','XMLNS="HTTP://WWW.DCA.GOV.UK/X
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <RegistrationMessage xmlns="http://www.dca.gov.uk/xmlschemas/libra" xmlns:apd="h
    ttp://www.govtalk.gov.uk/people/AddressAndPersonalDetails" xmlns:bsa="http://www
    .govtalk.gov.uk/people/bs7666" xmlns:cor="http://www.govtalk.gov.uk/core" xmlns:
    fin="http://www.govtalk.gov.uk/financial/GDSCFinancialTypes" xmlns:org="http://w
    ww.govtalk.gov.uk/financial/OrganisationIdentifiers" xmlns:pds="http://www.govta
    lk.gov.uk/people/PersonDescriptives" xmlns:xsi="http://www.w3.org/2001/XMLSchema
    -instance">
      <Registration>
        <CTOcode>ABC01C</CTOcode>
      </Registration>
    DELETEXML(OBJECT_VALUE,'/REGISTRATIONMESSAGE/@*','XMLNS="HTTP://WWW.DCA.GOV.UK/X
    </RegistrationMessage>
    SQL>Note that those peski namespace prefix mappings that start with xmlns: are not really attributes, so you cannot remove them, if that's what you were trying to do, so you are going to have to make sure that you provide namespace prefix mapping to the other operations on the document

  • XPATH + namespaces in 8i not possible?

    Hi,
    im trying to use the XPATH helper package to search a XML document that uses namespaces but it cant match anything:
    <bt1:root xmlns:bt1="http://127.0.0.1">
    <bt1:Error>
    <test>test value</test>
    for example i want 'test' yet when i try to get it using the pl/sql xpath package (in Steve Muench's oracle xml applications book) i get a NULL back.
    result := xpath.valueOf (xmldoc, '//bt1:Error/test');
    result is always null.
    if i remove the NS prefix it works fine.
    is it possible to modify this package to work with a NS? or is there another way of doing this?
    (the xml i recieve is from an external source and cant be modified btw)
    im using Oracle 8.1.7.2 (with the 9i xml xdk)
    Thanks

    I am finding myself asking the same question. I'm trying to use a count() function to find out how many nodes match the XPath pattern I specify. I'm using the PL/SQL API, but since that wraps the Java API, I'm sure that if it doesn't work in Java, it surely won't work in PL/SQL.
    It's been over six weeks since you posted your question, and no one from Oracle has troubled to reply. Is all Oracle support as lame as this?

  • Default Namespace Support

    Hi,
    I am NOT using the XPath helper package. I am using xslprocessor.selectNodes() to get a nodelist.
    My xml document contains a default namespace, and I cannot change it.
    Is there a work around to the fact that default namespaces is not supported? I'm getting "Namespace prefix 'x' is used but not declared" on the following pl/sql line:
    guests := xslprocessor.selectNodes(xmldom.makeNode(xmldoc), '/xml/rs:data/z:row');
    I'm willing to jump through a few hoops, if necessary.
    Thanks for any insight!
    Regina

    Correction. Please use the following test case.
    1. Create an application and a project in JDeveloepr 11g.
    2. Add an XML document. catalog.xml, from the New Gallery.
    What doesn't generate an error.
    3. Copy the following XML documen to catalog.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <catalog xmlns:journal="http://www.xdk11g.com/xpath">
    <journal:journal journal:date="November-December 2008">
    <journal:article journal:section="ORACLE DEVELOPER">
    <title>Instant ODP.NET Deployment</title>
    <author>Mark A. Williams</author>
    </journal:article>
    </journal:journal>
    <journal date="March-April 2008">
    <article section="TECHNOLOGY">
    <title>Oracle Database 11g Redux</title>
    <author>Tom Kyte</author>
    </article>
    </journal>
    </catalog>
    4. Select Search>XPath Search.
    5. Add a namespace mapping with Add button.
    Prefix: journal
    URI: http://www.xdk11g.com/xpath
    6. Specify an XPath expression in Expression field.
    /catalog/journal:journal
    7. Click on OK. The jounal:journal node gets selected.
    What generates an error (the bug).
    8. Copy the following XML document to catalog.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <catalog xmlns="http://www.xdk11g.com/xpath/defaultNamespace">
    <journal date="November-December 2008">
    <article section="ORACLE DEVELOPER">
    <title>Instant ODP.NET Deployment</title>
    <author>Mark A. Williams</author>
    </article>
    </journal>
    <journal date="March-April 2008">
    <article section="TECHNOLOGY">
    <title>Oracle Database 11g Redux</title>
    <author>Tom Kyte</author>
    </article>
    </journal>
    </catalog>
    9. Add a namespace mapping with Add button for the default namespace. Specify prefix as empty.
    Prefix:
    URI: http://www.xdk11g.com/xpath/defaultNamespace
    10. Specify an XPath expression in Expression field.
    /catalog/journal
    11. Click on OK. The journal node does not get selected.

  • Dynamic interface determination based on file content

    Dear all,
    I am trying for a while to solve my issue, but wasn't able to find the answer. Maybe you could point me in the right direction whether using standard or BPM...
    I've got one file with multiple entries. Dependend on a field value, I would like to call the right interface and Idoc.
    Sample message:
    <customers>
         <customer>
              <name>ABC</name>
              <city>XYZ</city>
              <trigger>A</trigger>
         </customer>
         <customer>
              <name>DEF</name>
              <city>QRT</city>
              <trigger>A</trigger>
         </customer>
         <customer>
              <name>GHI</name>
              <city>JKL</city>
              <trigger>B</trigger>
         </customer>
         <customer>
              <name>MKN</name>
              <city>TZG</city>
              <trigger>A</trigger>
         </customer>
    </customers>
    Dependend on the content of field "trigger" I would like to send the message to the correct interface (Idoc). I was able to trigger the interface selection in my interface determination based on a condition. So I am looking for field trigger and if = A -> Interface A is called and if = B -> interface B is called. However, it seems it is only checking for the first entry of my payload and then sending all customers to the same interface, no matter what I've got in the trigger field. What I would need is a message split and then only posting the correct rows to the selected interface.
    Any ideas would be highly appreciated.
    Thanks a lot,
    Jens

    Hi Jens,
    I can think of two options:
    1) The logical expression (condition) in the Interface Determination can hold a XPath expression. In your case, it could be complex, as one single XPath has to loop at all the line times for an occurrance.
    Some XPath help is available at: http://www.w3schools.com/xpath/xpath_functions.asp#sequence
    /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination
    The objective will be to remove the contexts on the trigger node to get a sequence consisting only of the trigger values, and then performing an 'index-of' function on value 'A'. If the result is a null value, then that trigger does not exist and the interface determination will not pass for 'A'. Similar condition can be used for other values of trigger.
    2) Create a separate receiver system / service for each interface A, B etc. Then you can use the enhanced Receiver Determination feature in the IR itself if you are on SP16. Check this:
    /people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16
    Good luck,
    Bhanu

  • Creating a Places Keyword Tag

    Greetings,
    When I create a keyword tag in the Places category, it doesn't allow me to input the GPS coordinates.
    I have some pictures that have GPS coordinates in the metadata. Is it possible to create keyword tags from the pictures, so that the new tags will have the proper lattitude and longitude?
    I'm using PSE9 on Windows.
    Thanks,
    Shane.

    If you want to transform rows to columns in your tag queries, you can use the predefined XSLT "RowToColumnTransform.xsl". You can find in MII in folder "/XMII/Stylesheets/". After flipping rows and columns, you can use a repeater to go through the rows. Use the [SAP Help link: XSL Transformation action|http://help.sap.com/saphelp_mii121/helpdata/en/43/e80b59ad40719ae10000000a1553f6/frameset.htm] to process the XSLT.
    Use XPath to pick the query values and link them to your Data Item values. Also see the [XPath help|http://www.w3schools.com/xpath/default.asp].
    Michael

  • Help with getting a node xpath from within the rules engine

    I'm new here and to BizTalk.  In the rule composer I've setup my vocabularies and have started implementing rules. 
    When a rule is evaluated to false I have a custom function called AddValidationError which is attached to the Action section.  This method accepts three parameters, a TTypedXmlDocument containing
    the validation errors node, an xpath to the node that was validated and an error code.  AddValidationErrors will append a new ValidationError node to the validation errors node containing the error code, error message, severity, and the xpath of the node
    that was validated.
    The issue is that I can't figure out how to get the xpath to the node being validated so that I can pass it to the AddValidationError function.  I have tried defining the xpath parameter as
    a TTypedXmlDocument which allows me to pass nodes of type TTypedXmlDocument, from there i can working the xpath but this doesn't allow me to pass nodes of other types, such as String, Int, DateTime, etc.
    Basically I want to be able to add the xpath to the node being validated into the validation errors.  I noticed that the Predicate function Exists cal accepts any node from which it resolves
    the xpath however I can't figure out how it does this.
    Anyway I was hoping that someone could point me in the right direction.  How can I pass a node of any type to a function, or get the xpath to node being validated which I can then simply pass
    as a string.
    Note that I am aware that I can simply type the xpath or copy it from the node properties window but the rule will be managed by people who are not developers, e.g. BA's or system administrators.
     I don't really want to expect them to write an xpath query or piece one together from the node properties.  I also thought that I could add two definition's for each node, one of the value type (String, decimal, DateTime) and another of type TTypedXmlDocument
    and pass the TTypedXmlDocument one to the AddValidationError method, which works but its not really ideal. 

    Can you post the exact issue and what you really need ?
    Do you want to create a Vocabulary or Rule with the predicate functions?
    Regards, Aboorva Raja R Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Help Page Error: Using XPath expressions as list indexes and map keys

    The help page says for maps to use the XPath expression
    /process_data/mapvar[@id='/process_data/@stringvar']
    But in reality for things to work you have to omit the quotations.

    thanks a lot for your help..
    there are total 162 records in the v$open_cursor for that user.
    among that the open cursor is only 4 and open-recursive cursor is only 6 for that user.
    in my session i am executing only the renaming of the constraints and nothing more.
    When i have queried the v$open_cursor for cursor_type='OPEN' for all the users, then i got that it has exceeded the value of open_cursors parameter.
    So how can i resolve that....

  • Xpath expression is empty for input XML file - Help!!!

    Hi,
    I am desperate by now!!! :-(
    I am not able to read an XML file using the File Adapter
    when trying to assign the input I get the following error:
    06/06/08 09:15:10 at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.evalFromValue(BPELAssignWMP.java:490)
    06/06/08 09:15:10 at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.__executeStatements(BPELAssignWMP.java:122)
    06/06/08 09:15:10 at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:188)
    06/06/08 09:15:10 at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3408)
    06/06/08 09:15:10 at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1836)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:166)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:252)
    06/06/08 09:15:10 at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5438)
    06/06/08 09:15:10 at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1217)
    06/06/08 09:15:10 at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:511)
    06/06/08 09:15:10 at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:335)
    06/06/08 09:15:10 at ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.handleInvoke(ICubeDeliveryLocalBean_StatelessSessionBeanWrapper16.java:1796)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessageHandler.handle(InvokeInstanceMessageHandler.java:37)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(DispatchHelper.java:125)
    06/06/08 09:15:10 at com.collaxa.cube.engine.dispatch.BaseScheduledWorker.process(BaseScheduledWorker.java:70)
    06/06/08 09:15:10 at com.collaxa.cube.engine.ejb.impl.WorkerBean.onMessage(WorkerBean.java:86)
    06/06/08 09:15:10 at com.evermind.server.ejb.MessageDrivenBeanInvocation.run(MessageDrivenBeanInvocation.java:123)
    06/06/08 09:15:10 at com.evermind.server.ejb.MessageDrivenHome.onMessage(MessageDrivenHome.java:755)
    06/06/08 09:15:10 at com.evermind.server.ejb.MessageDrivenHome.run(MessageDrivenHome.java:928)
    06/06/08 09:15:10 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    06/06/08 09:15:10 at java.lang.Thread.run(Thread.java:534)
    <2006-06-08 09:15:10,384> <ERROR> <default.collaxa.cube.xml> com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure}
    messageType: {null}
    parts: {{summary=<summary>empty variable/expression result.
    [b]xpath variable/expression expression "/ns6:SUPPLIERS_ORDER_NUMBER" is empty at line 23, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns6:SUPPLIERS_ORDER_NUMBER" is not empty.
    </summary>}}
    this is my XML file:
    <?xml version="1.0" encoding="utf-8"?>
    <SUPPLIERS_ORDER_NUMBER>"XX"</SUPPLIERS_ORDER_NUMBER>
    this is my xsd file:
    <xs:schema
    targetNamespace="http://schemas.oracle.com/service/bpel/common"
    xmlns:common = "http://schemas.oracle.com/service/bpel/common"
    xmlns:xs = "http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xs:element name="SUPPLIERS_ORDER_NUMBER" type="xs:string"/>
    </xs:schema>
    Please help me
    thanks
    Amit

    Hi,
    This is my file adapter wsdl file:
    <definitions
    name="fileAdapter"
    targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/file/"
    xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/file/"
    xmlns="http://schemas.xmlsoap.org/wsdl/" >
    <types>
    <schema attributeFormDefault="qualified" elementFormDefault="qualified"
    targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/file/"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:FILEAPP="http://xmlns.oracle.com/pcbpel/adapter/file/">
    <element name="InboundFileHeaderType">
    <complexType>
    <sequence>
    <element name="fileName" type="string"/>
    <element name="directory" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    </types>
    <!-- Header Message -->
    <message name="InboundHeader_msg">
    <part element="tns:InboundFileHeaderType" name="inboundHeader"/>
    </message>
    </definitions>
    So , should I use http://xmlns.oracle.com/pcbpel/adapter/file/ as my targetNamespace?
    for example:
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/file/"
    xmlns="http://xmlns.oracle.com/pcbpel/adapter/file/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    Thanks
    Amit

  • XPath expression help

    I have an xml structure (see XML at bottom) which i want to traverse using the xpath (PL/SQL) utility.
    I have written code that mainly uses xpath.selectNodes(...,...)
    I can select the customers easily by using
    xpath.selectNodes(...,'//customers_item')
    FOR i IN 1..NVL(xmldom.getlength(lov_customers),0) LOOP
    END LOOP;
    but what I want is to get the products for EACH customer.
    What I have inside the FOR LOOP is this
    xpath.selectNodes(ip_xml_dom, '//customers_item/products/product');
    but this gives me all products for all customers not the current customer.
    I know if that if I put the correct sytax in the XPath expression I can get what I want?
    I can't work this out, can anyone help
    <GetProfileResponse>
    <Return>
    <site>
    <customers>
    <customers_item>
    <id>1<id>
    <products>
    <product>
    <prodid>100</prodid>
    </product>
    <product>
    <prodid>101</prodid>
    </product>
    </products>
    </customers_item>
    <customers_item>
    <id>2<id>
    <products>
    <product>
    <prodid>102</prodid>
    </product>
    <product>
    <prodid>103</prodid>
    </product>
    </products>
    </customers_item>
    </customers>
    </site>
    </Return>
    </GetProfileResponse>
    null

    The following code works fine for me using PLSQL XML Parser 1.0.2 in Oracle8i 8.1.6 and produces the output:
    Customer id:1
    --> Prod id:100
    --> Prod id:101
    Customer id:2
    --> Prod id:102
    --> Prod id:103
    SET SERVEROUTPUT ON
    DECLARE
    xml VARCHAR2(2000) :=
    '<GetProfileResponse>
    <Return>
    <site>
    <customers>
    <customers_item>
    <id>1</id>
    <products>
    <product>
    <prodid>100</prodid>
    </product>
    <product>
    <prodid>101</prodid>
    </product>
    </products>
    </customers_item>
    <customers_item>
    <id>2</id>
    <products>
    <product>
    <prodid>102</prodid>
    </product>
    <product>
    <prodid>103</prodid>
    </product>
    </products>
    </customers_item>
    </customers>
    </site>
    </Return>
    </GetProfileResponse>';
    p xmlparser.parser;
    d xmldom.DOMDocument;
    n xmldom.DOMNode;
    nl_outer xmldom.DOMNodeList;
    ct_outer NUMBER;
    nl_inner xmldom.DOMNodeList;
    ct_inner NUMBER;
    xpCusts VARCHAR2(80);
    xpProds VARCHAR2(80);
    BEGIN
    xpCusts := '/GetProfileResponse/Return/site/customers/customers_item';
    xpProds := './/products/product';
    p := xmlparser.newparser();
    xmlparser.parseBuffer(p,xml);
    d := xmlparser.getDocument(p);
    n := xmldom.makeNode(d);
    nl_outer := xslprocessor.selectNodes(n,xpCusts);
    ct_outer := xmldom.getLength(nl_outer);
    FOR i IN 0..ct_outer-1 LOOP
    n := xmldom.item(nl_outer,i);
    dbms_output.put_line('Customer id:'&#0124; &#0124;xslprocessor.valueOf(n,'id'));
    nl_inner := xslprocessor.selectNodes(n,xpProds);
    ct_inner := xmldom.getLength(nl_outer);
    FOR j IN 0..ct_inner-1 LOOP
    n := xmldom.item(nl_inner,j);
    dbms_output.put_line('--> Prod id:'&#0124; &#0124;xslprocessor.valueOf(n,'prodid'));
    END LOOP;
    END LOOP;
    xmldom.freeDocument(d);
    xmlparser.freeparser(p);
    END;
    /

  • XPATH statement help

    I'm trying to write a little learning game in Flash, using
    XML as the data source, but I can't get any XPATH statements to
    work. I've written tons of XPATH against this structure in
    JavaScript, and the XPATH statements evaluate properly in XML Spy,
    but I always get "undefined" when I try to trace out the value of
    the XPATH statements in Flash 8.
    I'll post a valid (to XML Spy, that is) XPATH statement and
    some sample code...
    Thanks much for any help!
    Mike

    Okay, I'm experimenting now, I'll post if I figure out
    anything useful. Although I admit, I'm not going to waste a lot of
    time on this, if it looks like it's going to be overly difficult
    (which it appears at this point it will be) given the limited
    implementation, I'm just going to port the game to DHTML/Javascript
    and use a decent XPATH implementation. I have probably 10 or more
    relatively complex XPATH statements that I want to use, similiar in
    logic to:
    get all <theText> nodes whose parent <question>
    node has a learningWheelUsage attribute set to "yes".
    This is really simple in every other environment that I work
    in, and I'm thinking it would just be easier to port the game to
    something else than try to hack together a solution out of Flash's
    limited implementation.
    I'd want to put those into an array of course.. I haven't
    given up hope yet, I'm going to do some more experimenting, but it
    is FRUSTERATING!!!!! hahaha..
    Thanks for the help!
    Mike

  • XPath - how to get non exist nodes? please help!

    Hi!
    There is a so xml structure:
    main_node
    node_a
    node_a_1
    node_a_2
    node_a_3
    the 'node_a' node repeats 3times in the XML. The 'node_a_2' node is not in the first recurrence of 'node_a' node.
    When I want to get the 'node_a_2' nodes by XPath, I get a List, which consists of 2 element.
    But I want to get a so list, which consists of 3 elements, the first is null and the others are the elements of 'node_a_2' node!
    This is the code:
    List getElementByXPath(String Path) throws org.jaxen.JaxenException {
    org.jaxen.XPath P = new org.jaxen.jdom.JDOMXPath("/"+Path.replace(".","/"));
    List Back = P.selectNodes(ArrivedXML.getRootElement());
    return Back;
    Please help, how can i do it!
    Thank You very much!
    rflair

    the structure again...:
    main_node
    ....node_a
    ........node_a_1
    ........node_a_2
    ........node_a_3

  • 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

  • Need help with accesing variable with xpath.

    Hi All,
    I need help with xpath in "Switch" BPEL construct. Switch is used to compare value assigned to output vairable and follow one path for "Deny" and another for "Approve". The following is data type for output variable.
    <element name="processResponse">
         <complexType>
              <sequence>
                   <element name="result" type="string"/>
              <sequence>
         <complexType>
    </element>
    The following expressions in Switch statement throw lava.lang.Exception. It error is xpath internal error".
    x20:compare('Deny',$outputvariable.payload/client:result)
    x20:compare('Deny',bpws:getVariableData('outputvariable','payload','/client:processResponse/client:result')
    It works with x20:compare('Deny','Deny'). So I assumed it must be accessing the variable.
    Any help greatly appreciated.
    Thanks,
    Satish

    Cany you try the following
    x20:compare('Deny',string($outputvariable.payload/client:result))
    x20:compare('Deny',string(bpws:getVariableData('outputvariable','payload','/client:processResponse/client:result'))
    Regards
    Albin I
    http://www.albinsblog.com/

Maybe you are looking for

  • Help with Adobe Photoshop elements 10 download

    I have been trying for 3 days to download a copy of PSE 10. I have tried everything suggested in the forums with no luck. I even tried the direct download links and they did't work. I received a copy of PSE 10 from a promotion with EVGA. I can't unde

  • FORMAT command hangs on SOL 10...

    I have V440...when I run the FORMAT command, it just hangs there. Here is a metastat cmd output: # metastat d6: Mirror Submirror 0: d16 State: Needs maintenance Submirror 1: d26 State: Resyncing Resync in progress: 20 % done Pass: 1 Read option: roun

  • After losing and restoring datebook files in ver 6.2.2 thoughts

    If the  Datebook.mdb.bak is a backup file couldn't we rename it and since it has 1336   kb instead  of  approx 3000 like the others maybe it would be the correct info from before my crash 3 days ago without all the dupes .If that is correct can I cop

  • Factors governing start time in purchase requisitions

    Hi, What are the factors which decides 'Time' in start date of purchase requisition? I executed heuristics for 1 location-product, there is different time in start date of PRs Means 1 PR is showing start time as 11.45 and other is showing as 8.45 We

  • Oracle Protocol support info required

    Hi, I'm using Oracle 10g r2,on windows ,my question is Oracle supports following protocol on windows environment. TCP TCPS IPC NMP If yes then how I can change my current TCP protocol in my Oracle. Thanks Faheem