How to query for XML-attribute with XPATH

Hi,
Isn't there somebody, who can tell me how to query an Attribut of an XML-element correctly ?
All my trials lead to empty rows. What's worng in my XPATH-expresion ?
XML-file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xmlexport>
<itsystem guid="e51b91d1-ab0f-11db-2cd7-001641105333">
<field fieldidentifier="currentVersion" />
<field fieldidentifier="marketdatacosts">0</field>
I can query fine the elements and sub-elements, but not attribute 'guid' of /xmlexport/itsystem. Here some trials, all lead
SELECT t.* FROM CORIA."xmlexport156_TAB", xmltable ('/xmlexport/itsystem ' passing object_value COLUMNS
GUID     VARCHAR2(1000) path '[@guid=*]') t
various versions for Xpath:
path '[@guid="*"]'
path '/[@guid=*]'
path '[@guid=*]'
xmltable ('/xmlexport' ...
path '/itsystem/[@guid=*]'
... combinations of part 1 and 2
thanks for any hint, LaoDe

You can either get them directly, or fetch the attribute in your xquery and put them in returning xml fragment, then get them like normal element.
Method #1:
path '@guid'
Method #2:
xmltable(
let $is := /xmlexport/itsystem
return <r><guid>{$is/@guid}</guid></r>
passing object_value
columns guid varchar2(1000) path '/r/guid')

Similar Messages

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • SSMS 2012:FOR XML PATH Using XPath Node Tests-Columnn name 'test()' contains an invalid XML identifier as required by FOR XML?

    Hi all,
    I am learning XPATH and XQUERY from the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles, (published by apress). I copied the Code Listing 12-8 FOR XML PATH Using XPath Node Tests (listed below) and executed it in my
    SQL Server 2012 Management Studio:
    --Coles12_8.sql // saved in C:/Documemnts/SQL Server Management Studio
    -- Coles Listing 12-8 FOR XML PATH Using XPATH Node Tests
    -- Retrieving Name and E-mail Addresses with FOR XML PATH in AdvantureWorks
    -- 16 March 2015 0935 AM
    USE AdventureWorks;
    GO
    SELECT
    p.NameStyle AS "processing-instruction(nameStyle)",
    p.BusinessEntityID AS "Person/@ID",
    p.ModifiedDate AS "comment()",
    pp.PhoneNumber AS "test()",
    FirstName AS "Person/Name/First",
    MiddleName AS "Person/Name/Middle",
    LastName AS "Person/Name/Last",
    EmailAddress AS "Person/Email"
    FROM Person.Person p
    INNER JOIN Person.EmailAddress e
    ON p.BusinessEntityID = e.BusinessEntityID
    INNER JOIN Person.PersonPhone pp
    ON p.BusinessEntityID = pp.BusinessEntityID
    FOR XML PATH;
    I got the following error message:
    Msg 6850, Level 16, State 1, Line 2
    Column name 'test()' contains an invalid XML identifier as required by FOR XML; '('(0x0028) is the first character at fault.
    I have no ideas why I got this error message.  Please kindly help and advise me how to resolve this error.
    Thanks in advance,  Scott Chang

    Hi Michelle, Thanks for your nice response.
    I corrected the mistake and executed the revised code. It worked nicely.
    I just have one question to ask you about the appearance of the xml output of my Co;les12_8.sql:
    <row>
    <?nameStyle 0?>
    <Person ID="1" />
    <!--2003-02-08T00:00:00-->697-555-0142<Person><Name><First>Ken</First><Middle>J</Middle><Last>Sánchez</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="2" />
    <!--2002-02-24T00:00:00-->819-555-0175<Person><Name><First>Terri</First><Middle>Lee</Middle><Last>Duffy</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="3" />
    <!--2001-12-05T00:00:00-->212-555-0187<Person><Name><First>Roberto</First><Last>Tamburello</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="4" />
    <!--2001-12-29T00:00:00-->612-555-0100<Person><Name><First>Rob</First><Last>Walters</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="5" />
    <!--2002-01-30T00:00:00-->849-555-0139<Person><Name><First>Gail</First><Middle>A</Middle><Last>Erickson</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="6" />
    <!--2002-02-17T00:00:00-->122-555-0189<Person><Name><First>Jossef</First><Middle>H</Middle><Last>Goldberg</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="7" />
    <!--2003-03-05T00:00:00-->181-555-0156<Person><Name><First>Dylan</First><Middle>A</Middle><Last>Miller</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="8" />
    <!--2003-01-23T00:00:00-->815-555-0138<Person><Name><First>Diane</First><Middle>L</Middle><Last>Margheim</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="9" />
    <!--2003-02-10T00:00:00-->185-555-0186<Person><Name><First>Gigi</First><Middle>N</Middle><Last>Matthew</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="10" />
    <!--2003-05-28T00:00:00-->330-555-2568<Person><Name><First>Michael</First><Last>Raheem</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    <?nameStyle 0?>
    <Person ID="11" />
    <!--2004-12-29T00:00:00-->719-555-0181<Person><Name><First>Ovidiu</First><Middle>V</Middle><Last>Cracium</Last></Name><Email>[email protected]</Email></Person></row>
    <row>
    I feel this xml output is not like the regular xml output.  Do you know why it is diffrent from the regular xml xml output?  Please comment on this matter.
    Thanks,
    Scott Chang
    What do you mean by regular xml document? Are you referring to fact that its missing a root element? if yes it can be added as below
    USE AdventureWorks;
    GO
    SELECT
    p.NameStyle AS "processing-instruction(nameStyle)",
    p.BusinessEntityID AS "Person/@ID",
    p.ModifiedDate AS "comment()",
    pp.PhoneNumber AS "text()",
    FirstName AS "Person/Name/First",
    MiddleName AS "Person/Name/Middle",
    LastName AS "Person/Name/Last",
    EmailAddress AS "Person/Email"
    FROM Person.Person p
    INNER JOIN Person.EmailAddress e
    ON p.BusinessEntityID = e.BusinessEntityID
    INNER JOIN Person.PersonPhone pp
    ON p.BusinessEntityID = pp.BusinessEntityID
    FOR XML PATH('ElementName'),ROOT('RootName');
    replace ElementName and RootName with whatever name you need to set for element as well as the root element
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Parsing XML string with XPath

    Hi,-
    I am trying to parse an XML string with xpath as follows but I am getting null for getresult.
    I am getting java.xml.xpath.xpathexpressionexception at line where
    getresult = xpathexpression.evaluate(isource); is executed.
    What should I do after
    xpathexpression = xPath.compile("a/b");in the below snippet?
    Thanks
    String xmlstring ="..."; // a valid XML string;
    Xpath xpath = XPathFactory.newInstance().newPath();
    xpathexpression = xPath.compile("a/b");
    // I guess the following line is not correct
    InputSource isource = new inputSource(new ByteArrayInputStream(xmlstring.getBytes())); right
    getresult = xpathexpression.evaluate(isource);My xml string is like:
    <a>
      <b>
         <result> valid some more tags here
         </result>
      </b>
      <c> 10
      </c>
    </a>Edited by: geoman on Dec 8, 2008 2:30 PM

    I've never used the version of evaluate that takes an InputSource. The difficulty with using it is that it does not save the DOM object. Each expression you evaluate will have to create the DOM object, use it once and then throw it away. I've yet to write a program that only needs one answer from an XML document. Usually, I use XPath to locate somewhere in a document and then read "nearby" content, add new content nearby, delete content, or move content. I'd suggest you may want to parse the XML stream and save the DOM Document.
    Second, all of the XPath expressions search from a "context node". I have not had good luck searching from the Document object, so I always get the root element first. I think the expression should work if you use the root as the context node. You will need one of the versions of evaluate that uses an Object as the parameter.

  • Xml Attributes with ADG

    Hi all,
    i'm new to flex.I have a problem regarding XML
    attributes."How to get the XML attribute value from the xml file to
    Flex application using HTTPService".I tried but it is coming only
    one attribute value.
    First i have to get the attribute values from the XML file
    and display in AdvancedDataGrid with tree structure.
    Here i will send my XML file and MXML file...
    Can u see and check my code............plzzz
    XML file................
    <?xml version="1.0" encoding="UTF-8"?>
    <todolist>
    <folder state="" label="Today todo list" isBranch="true"
    >
    <folder cat="Travel" state="High" duedate="3/09/2008"
    isBranch="false" label="book tickets" />
    <folder cat="Social" state="Low" duedate="4/09/2008"
    isBranch="false" label="Meeting at 7pm" />
    <folder state="" isBranch="true" label="Home " >
    <folder cat="Home" state="High" duedate="3/09/2008"
    isBranch="false" label="Pay power bill" />
    <folder cat="Home" state="High" duedate="3/09/2008"
    isBranch="false" label="Pay rent" />
    <folder cat="Home" state="Low" duedate="3/09/2008"
    isBranch="false" label="Call parents" />
    <folder cat="Home" state="Low" duedate="3/09/2008"
    isBranch="false" label="Attend John birthday party" />
    <folder cat="Home" state="Medium" duedate="3/09/2008"
    isBranch="false" label="Special Updates" />
    <folder cat="Home" state="high" isBranch="false"
    label="get Dr. appointment" />
    </folder>
    <folder state="" isBranch="true" label="Office " >
    <folder cat="Off" state="High" isBranch="false"
    label="Meeting at 5pm" />
    <folder cat="Off" state="Low" isBranch="false"
    label="Complete document and send to client" />
    <folder cat="Off" state="Low" isBranch="false"
    label="Interviews and Transcripts" />
    <folder cat="Off" state="High" isBranch="false"
    label="Set Deployment machine" />
    <folder cat="Off" state="High" isBranch="false"
    label="send status reports" />
    </folder>
    </folder>
    </todolist>
    MXML file............
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    initialize="adgService.send()">
    <mx:HTTPService id="adgService" url="adg.xml"/>
    <mx:AdvancedDataGrid
    dataProvider="{adgService.lastResult.todolist.folder}">
    <mx:columns>
    <mx:AdvancedDataGridColumn headerText="Name"
    dataField="label"/>
    <mx:AdvancedDataGridColumn headerText="Age"
    dataField="state"/>
    </mx:columns>
    </mx:AdvancedDataGrid>
    </mx:Application>
    Thnaks & Regards
    edeewan

    "edeewan" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hi all,
    > i'm new to flex.I have a problem regarding XML
    attributes."How to
    > get
    > the XML attribute value from the xml file to Flex
    application using
    > HTTPService".I tried but it is coming only one attribute
    value.
    >
    > First i have to get the attribute values from the XML
    file and display in
    > AdvancedDataGrid with tree structure.
    > Here i will send my XML file and MXML file...
    > Can u see and check my code............plzzz
    >
    > XML file................
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <todolist>
    > <folder state="" label="Today todo list"
    isBranch="true" >
    >
    > <folder cat="Travel" state="High" duedate="3/09/2008"
    isBranch="false"
    > label="book tickets" />
    > <folder cat="Social" state="Low" duedate="4/09/2008"
    isBranch="false"
    > label="Meeting at 7pm" />
    >
    > <folder state="" isBranch="true" label="Home " >
    >
    > <folder cat="Home" state="High" duedate="3/09/2008"
    isBranch="false"
    > label="Pay power bill" />
    > <folder cat="Home" state="High" duedate="3/09/2008"
    isBranch="false"
    > label="Pay rent" />
    > <folder cat="Home" state="Low" duedate="3/09/2008"
    isBranch="false"
    > label="Call parents" />
    > <folder cat="Home" state="Low" duedate="3/09/2008"
    isBranch="false"
    > label="Attend John birthday party" />
    > <folder cat="Home" state="Medium" duedate="3/09/2008"
    > isBranch="false"
    > label="Special Updates" />
    > <folder cat="Home" state="high" isBranch="false"
    label="get Dr.
    > appointment" />
    >
    > </folder>
    >
    > <folder state="" isBranch="true" label="Office " >
    >
    > <folder cat="Off" state="High" isBranch="false"
    label="Meeting
    > at
    > 5pm" />
    > <folder cat="Off" state="Low" isBranch="false"
    label="Complete
    > document and send to client" />
    > <folder cat="Off" state="Low" isBranch="false"
    > label="Interviews
    > and Transcripts" />
    > <folder cat="Off" state="High" isBranch="false"
    label="Set
    > Deployment
    > machine" />
    > <folder cat="Off" state="High" isBranch="false"
    label="send status
    > reports" />
    >
    > </folder>
    >
    > </folder>
    > </todolist>
    >
    >
    > MXML file............
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    > layout="absolute"
    > initialize="adgService.send()">
    >
    > <mx:HTTPService id="adgService" url="adg.xml"/>
    > <mx:AdvancedDataGrid
    >
    dataProvider="{adgService.lastResult.todolist.folder}">
    > <mx:columns>
    > <mx:AdvancedDataGridColumn headerText="Name"
    dataField="label"/>
    > <mx:AdvancedDataGridColumn headerText="Age"
    dataField="state"/>
    > </mx:columns>
    > </mx:AdvancedDataGrid>
    >
    > </mx:Application>
    >
    > Thnaks & Regards
    > edeewan
    Try
    <mx:AdvancedDataGrid
    dataProvider="{adgService.lastResult.folder}">

  • How to remove the XML attribute value in Indesign file by javascript

    Hi all,
    How to remove the XML attribute value in Indesign file.

    Try this,
    if(elm.xmlElements[i].xmlAttributes[j].name == "aid:pstyle" || elm.xmlElements[i].xmlAttributes[j].name == "aid:cstyle")
    Vandy

  • How to use For-Each Structure with Multiple node XML structure

    Hi,
      How to use for-each (BPEL 2.0) construct for Multinode XML structure.
    Here is the easy case: I have list of suppliers specified by supplier
    <supplierList>
    <supplier>1</supplier>
    <supplier>2</supplier>
    <supplier>3</supplier>
    </supplierList>
    Now there is a web service http://hostname/getsupplierdetails/wsdl which accepts one supplier at a time.
    like
    <supplier>1</supplier>
    reponse object is
    <message> notfound/found </message>
    But how can I use for each of XML node to call this service and collect the result like
    <supplierList1>
         <Suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
        <suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
    </supplierlist1>
    Thanks

    For looping you use foreach loop and , loop for the number of occurences and when constructing response, adding a new element you have to use bpelx:append.  Good sample at Enterprise Integration: Oracle SOA Suite 11g: Populating a list or an array in BPEL without using XSLT.

  • How to retrieve value of attribute using xPath ?

    Hello experts,
    I have a following xml chunk
    <image file="/articles/engineering/boxerengine/preview_282x160.jpg">
    <tout name="copyright"></tout>
    <tout name="license"></tout>
    <tout name="photographer"></tout>
    <tout name="description"></tout>
    </image>
    I want to retrieve value of attribute file from absolute node image.
    I tried using xpath='/image/@file' It gives output as file="/articles/engineering/boxerengine/preview_282x160.jpg"
    I just want value "/articles/engineering/boxerengine/preview_282x160.jpg"
    I tried using xpath='/image/@file/text()' . It does not work
    Following is the java code. I am using XOM parser.
    java code :
    Builder parser = new Builder();
    Document doc = parser.build(xmlFile);
    Nodes titles = doc.query(xPath);
    //xpath = ''/image/@file/text()"     
    for (int i = 0; i < titles.size(); i++) {
    strChunk = strChunk.append(titles.get(i).toXML());     
    return strChunk.toString();
    Please help.
    Thanks,
    Sandeep Parmar

    Hi Sandeep,
    Using XPath and XPathExpression you can evaluate XPath queries on Document. have a look at code given bellow:
    // Building Document from XML File
    org.w3c.dom.Document imageDoc = builder.parse(xmlFile);
    // getting new instance of XPath
    javax.xml.xpath.XPath xpath = javax.xml.xpath.XPathFactory.newInstance().newXPath();
    // Building XPathExpression by compiling XPath query
    javax.xml.xpath.XPathExpression xPathExp = xpath.compile("/image/@file");
    // Evaluting XPath Expression on Document
    String imagePath = (String) xPathExp.evaluate(imageDoc, javax.xml.xpath.XPathConstants.STRING);
    // Priting image path it will print : "/articles/engineering/boxerengine/preview_282x160.jpg", if you try with data given in your post.
    System.out.println(imagePath); Hope this will help.
    thanks,
    Tejas Purohit

  • Parse xml document with xpath

    I would like to parse an xml document using xpath, see:
    http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html
    however, in the documentation (in the link above), it states that I need J2SE 5.0.
    Currently, I have:
    $ java -version
    java version "1.5.0_11"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
    Does that mean that I really have to install J2SE 5.0 in order to use J2SE 5.0's XPath support? Does anybody know anything about getting started with XPath, and whether I can just use my existing version of Java? I've never used XPath.
    For more documentation, one can view:
    http://www.w3.org/TR/xpath20/
    Thank you.

    I have copied the code for the xpath tutorial on
    http://www.onjava.com/pub/a/onjava/2005/01/12/xpath.html
    exactly as it is on the tutorial, and imported the correct jars (I think).
    But still my code is giving lots of errors!
    Granted its my first shot but anyway here's the code and the errors...
    package test;
    import org.jdom.xpath.*;
    import java.io.*;
    import javax.xml.xpath.*;
    public class XPath {
         public static void main (String [] args){
              XPathFactory factory = XPathFactory.newInstance();
              XPath xPath=factory.newXPath();
              XPathExpression  xPathExpression=xPath.compile("/catalog/journal/article[@date='January-2004']/title");
              File xmlDocument = new File("/home/myrmen/workspace/Testing/test/catalog.xml");     
              //FileInputStream fis = new FileInputStream(xmldocument); 
              InputSource inputSource = new InputSource(new FileInputStream(xmlDocument));
              String title = xPathExpression.evaluate(inputSource);
              String publisher = xPath.evaluate("/catalog/journal/@publisher", inputSource);
              String expression="/catalog/journal/article";
              NodeSet nodes = (NodeSet) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);
              NodeList nodeList=(NodeList)nodes;
              SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
              org.jdom.Document jdomDocument = saxBuilder.build(xmlDocument);
              org.jdom.Attribute levelNode = (org.jdom.Attribute)(XPath.selectSingleNode(jdomDocument,"/catalog//journal[@title='JavaTechnology']" + "//article[@date='January-2004']/@level"));
              levelNode.setValue("Intermediate");
              org.jdom.Element titleNode = (org.jdom.Element) XPath.selectSingleNode( jdomDocument,"/catalog//journal//article[@date='January-2004']/title");
              titleNode.setText("Service Oriented Architecture Frameworks");
              java.util.List nodeList = XPath.selectNodes(jdomDocument,"/catalog//journal[@title='Java Technology']//article");
              Iterator iter=nodeList.iterator();
              while(iter.hasNext()) {
                   org.jdom.Element element = (org.jdom.Element) iter.next();
                   element.setAttribute("section", "Java Technology");
              XPath xpath = XPath.newInstance("/catalog//journal:journal//article/@journal:level");
              xpath.addNamespace("journal", "http://www.w3.org/2001/XMLSchema-Instance");
              levelNode = (org.jdom.Attribute) xpath.selectSingleNode(jdomDocument);
              levelNode.setValue("Advanced");
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         Type mismatch: cannot convert from XPath to XPath
         The method compile(String) is undefined for the type XPath
         InputSource cannot be resolved to a type
         InputSource cannot be resolved to a type
         NodeSet cannot be resolved to a type
         NodeSet cannot be resolved to a type
         NodeList cannot be resolved to a type
         NodeList cannot be resolved to a type
         SAXBuilder cannot be resolved to a type
         SAXBuilder cannot be resolved to a type
         The method selectSingleNode(Document, String) is undefined for the type XPath
         The method selectSingleNode(Document, String) is undefined for the type XPath
         Duplicate local variable nodeList
         The method selectNodes(Document, String) is undefined for the type XPath
         Iterator cannot be resolved to a type
         The method newInstance(String) is undefined for the type XPath
         The method addNamespace(String, String) is undefined for the type XPath
         The method selectSingleNode(Document) is undefined for the type XPath
         at test.XPath.main(XPath.java:12)

  • Urgent: how to query/index xml files to retrieve information belonging to a section?

    os: linux
    db: oracle 9iR2
    Hi,
    how can I extract -> only <- the matching entry information from within a xml file, that belongs to the result of a query?
    For example, given the following xml:
    <QualifierRecordSet>
    <QualifierRecord QualifierType = "1">
    <QualifierUI>Q000002</QualifierUI>
    <QualifierName>
    <String>test1</String>
    </QualifierName>
    <DateCreated>
    <Year>1973</Year>
    <Month>12</Month>
    <Day>27</Day>
    </DateCreated>
    </QualifierRecord>
    <QualifierRecord QualifierType = "1">
    <QualifierUI>Q000003</QualifierUI>
    <QualifierName>
    <String>test2</String>
    </QualifierName>
    <DateCreated>
    <Year>1975</Year>
    <Month>10</Month>
    <Day10</Day>
    </DateCreated>
    </QualifierRecord>
    <QualifierRecordSet>
    I would like to query for '/QualifierRecordSet/QualifierRecord/QualifierName[String = "test2"]' and retrieve ONLY the second 'QualifierRecord' - entry, i.e.:
    <QualifierRecord QualifierType = "1">
    <QualifierUI>Q000003</QualifierUI>
    <QualifierName>
    <String>test2</String>
    </QualifierName>
    <DateCreated>
    <Year>1975</Year>
    <Month>10</Month>
    <Day10</Day>
    </DateCreated>
    </QualifierRecord>
    ...but not the' id' or 'name' of the xml-document(I have only one document).
    Thanks for your help in advance.
    Best Regards,
    Dan

    extract() would do what you want. But your whole approach of only have 1 document makes no sense when working with an XML database. See my reply to the other post for more reasons.

  • Query for xml:id fails

    Hello,
    I have a problem querying for the id-Attribute. I guess the solution is simple but I just don't get it %). Could someone give me a hint on that?
    Xml-Snippet
    &lt;s xml:id="s100" n="s99"/&gt;
    I can successfully query the document for the sentence //s&#091;@xml:id="s100"&#093;
    I can also query for the n-Attribute: //s/@n
    But when I want to query for the xml:id attribute I get no results (and no error): //s/@xml:id
    //s/@id does not work either.
    What am I doing wrong?
    Best wishes,
    Peter
    Edited by: user524194 on Nov 17, 2009 1:10 AM
    Edited by: user524194 on Nov 17, 2009 1:11 AM

    Hi Peter,
    I'm afraid I'm not sure what's going on. You'll need to answer a few more questions:
    1) What indexes do you have?
    2) What storage and indexing model are you using (document or node)?
    3) What is the full query that you're using?
    4) What's the query plan for your query?
    5) Can you reproduce the problem with a minimal data set via the DB XML shell?
    John

  • How To read an XML file with JDom

    I have read through some tutorials after installing JDom on how to read an existing XML file and I was confused by all of them. I simply want to open an XML file and read one of the node's content. Such as <username>john doe</username> this way I can compare values with what the user has entered as their username. I am not sure were to start and I was hoping someone could help me out.
    I know that this seems like an insecure way to store login information but after I master opening and writing XML files with JDom I am going to use AES to encrypt the XML files.

    Here is a test program for JDom and XPath use considering your XML file is named "test.xml" :import org.jdom.input.*;
    import org.jdom.xpath.*;
    public class JDomXPath {
    public static void main(String[] args) {
      SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
      try {
       org.jdom.Document jdomDocument = saxBuilder.build("test.xml");
       org.jdom.Element usernameNode = (org.jdom.Element)XPath.selectSingleNode(jdomDocument, "//username");
       System.out.print(usernameNode.getText());
      } catch (Exception e) {
       e.printStackTrace();
    }(tested with Eclipse)

  • Mapping of XML attributes with XML elements in Mediator Transformations

    Hi,
    The soure XML look like as below in the source directory of file adapter/read:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!-- Edited by Oracle JDeveloper 11.1.1.1.3®
    -->
    <CATALOG>
    <PLANT COMMON="Bloodroot" BOTANICAL="Sanguinaria canadensis">
    <ZONE>4</ZONE>
    <LIGHT>Mostly Shady</LIGHT>
    <PRICE>$2.44</PRICE>
    <AVAILABILITY>031599</AVAILABILITY>
    </PLANT>
    <PLANT COMMON="Columbine" BOTANICAL="Aquilegia canadensis">
    <ZONE>3</ZONE>
    <LIGHT>Mostly Shady</LIGHT>
    <PRICE>$9.37</PRICE>
    <AVAILABILITY>030699</AVAILABILITY>
    </PLANT>
    <PLANT COMMON="Marsh Marigold" BOTANICAL="Caltha palustris">
    <ZONE>4</ZONE>
    <LIGHT>Mostly Sunny</LIGHT>
    <PRICE>$6.81</PRICE>
    <AVAILABILITY>051799</AVAILABILITY>
    </PLANT>
    </CATALOG>
    The target XML will be as below in the target directory of file adapter/write.:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!-- Edited by Oracle JDeveloper 11.1.1.1.3®
    -->
    <CATALOG>
    <PLANT>
    <COMMON>Bloodroot</COMMON>
    <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
    </PLANT>
    <PLANT>
    <COMMON>Columbine</COMMON>
    <BOTANICAL>Aquilegia canadensis</BOTANICAL>
    </PLANT>
    <PLANT><COMMON>Marsh Marigold</COMMON>
    <BOTANICAL>Caltha palustris</BOTANICAL>
    </PLANT>
    </CATALOG>
    So, I need to map attributes(COMMON and BOTANICAL) of XML data in the source with common and botanical elements of the XML in the target. How should I map attributes with elements in the XSL editor of the Mediator Transformation.
    Thanks,
    Arnab

    I will test it.
    I sale myself ONLY half CNY!

  • How to handle abstract XML elements with XMLBeans

    Hello,
    I have an xsd that uses abstract elements, and i wanted to ask you how can i create new XML Documents with XMLBeans? My problems is that i don't know how to handle abstaction with XMLBeans.
    Let me show you a very simple example to make you understand my problem :
    Suppose we have the following schema :
    <xsd:schema targetNamespace="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.org">
         <xsd:element name="Customer" type="CustomerType" />
         <xsd:complexType name="CustomerType" abstract="true" />
         <xsd:complexType name="PremiumCustomerType">
              <xsd:complexContent>
                   <xsd:extension base="CustomerType">
                        <xsd:sequence>
                             <xsd:element name="CreditCard" type="xsd:string" />
                        </xsd:sequence>
                   </xsd:extension>
              </xsd:complexContent>
         </xsd:complexType>
    </xsd:schema>I use XMLBeans to create a jar with java classes according the xsd above. Then, in order to create a new xml document i use the following code :
    CustomerDocument cd = CustomerDocument.Factory.newInstance();
    CustomerType ct = cd.addNewCustomer();
    PremiumCustomerType pct = PremiumCustomerType.Factory.newInstance();
    ct.changeType(pct.schemaType());With this code i get an XML Document like the following :
    <Customer type="PremiumCustomerType" />But after that, i cannot add an element CreditCard into this Customer element. Can anyone help me?

    In Indesign there is no way you can directly work on the XML-IN footnote, since indesign won't support XML tags in footnote stream.
    To achive that you need to have XSLT/Perl/Indesign Scripting.
    This task is achievable, you can create a auto footnote for XML workflow projects.
    1. Create an XSLT to transform the footnote to the respective places
    2. Change all the "<" ">" to some standard names, since indesign won't accept XML tags in the footnote stream.
    3. Import it in indesign and using script convert it to autofootnote.
    Shaji

  • How to "use" a xml file with a script?

    Hey Guys!
    I use the normal Button with the send-option to send the xml file to an url.
    My question is how it's possible to work in a php-script with the xml data out of the formular?
    Thanks for help.
    LG
    Adrian

    Hi,
    I need to read a XML document with StringReade class.
    My aplication receives an absolute path but this
    doesn't work:
    StringReader oStringReader =
    new StringReader(c:\java\libros.xml);
    However it works with:
    StringReader oStringReader =
    new StringReader("<?xml version="1.0" e......");
    ie, with the whole document as a String, but I need
    to do it as the frist way.
    Thankstake a look at this link:
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html

Maybe you are looking for

  • HT1331 How to connect external hard disk to airport time capsule and use it throughmy ipad ?

    I Have connected an external usb hard disk to airport time capsule. pleasea help me to configure it from my ipad and use it from my ipad.

  • "Unknown Error" msg. for Officejet J3640

    My printer, about 6 months old, has always been unreliable.  It refuses to print and it refuses to give me an error number or title.  I have searched all the posts here in the forum, I have run a test page (all okay), printed a document from Word 200

  • When trying to import photos from iPhoto organizer 12 crashes

    I installed new photoshop elements 12 and when It attempted to import photos from iphoto 9.5.1 it get to the 7th picture and then locks up, I have to force quit app. What can the problem be? I tried importing a few photos and it worked ok, I attempte

  • JBuilder code...

    Hello everybody, I've written a program in JBuilder wich can store encrypted passwords in a textfile. It works fine when using the 'run project' function in JBuilder, but when i try to compile or run it in the std DOS jdk I'm getting the error: 'NoCl

  • SME not in batch mode

    Hi, How to avoid this error? ODI-1228: Task SrcSet0 (Loading) fails on the target SUNOPSIS_ENGINE connection SUNOPSIS_MEMORY_ENGINE. Caused By: java.sql.SQLException: statement is not in batch mode Best regards, Greg