BEA XQuery Namespace Problem

Hi,
I'm facing problem in getting correct XQuery results with BEA when namespace is provided in XML Document.
I'm trying to execute XQuery against the following XML Document (having xmlns):
<?xml version="1.0"?>
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
     <templateId root="2.16.840.1.113883.3.27.1776"/>
     <id extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
     <code code="34095-0" codeSystem="2.16.840.1.113883.6.1" displayName="COMPREHENSIVE HISTORY & PHYSICAL NOTE"/>
     <title>Comprehensive History & Physical Note</title>
     <effectiveTime value="20060527"/>
     <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
     <setId extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
     <versionNumber value="1"/>
     <recordTarget>
          <patientRole>
               <id extension="pid_123" root="2.16.840.1.113883.4.49"/>
               <patient>
                    <name>
                         <given>John</given>
                         <family>Doe</family>
                    </name>
                    <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
                    <birthTime value="19580106"/>
               </patient>
               <providerOrganization>
                    <id extension="prov_123" root="2.16.840.1.113883.4.49"/>
               </providerOrganization>
          </patientRole>
     </recordTarget>
</ClinicalDocument>
XQuery is:
let $patFirstName := (//recordTarget/patientRole/patient/name/given)
return if ($patFirstName) then
          <result>true {$patFirstName}</result>
     else
          <result>false</result>
The above XQuery always result in false
I've tried the XQuery which is traversing through root:
let $patFirstName := (./ClinicalDocument/recordTarget/patientRole/patient/name/given)
return if ($patFirstName) then
          <result>true {$patFirstName}</result>
     else
          <result>false</result>
It also results in false.
Then I've changed the XML Document and removed its namespace declaration (xmlns) as:
<?xml version="1.0"?>
<ClinicalDocument>
     <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
     <templateId root="2.16.840.1.113883.3.27.1776"/>
     <id extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
     <code code="34095-0" codeSystem="2.16.840.1.113883.6.1" displayName="COMPREHENSIVE HISTORY & PHYSICAL NOTE"/>
     <title>Comprehensive History & Physical Note</title>
     <effectiveTime value="20060527"/>
     <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
     <setId extension="req_cda_123" root="2.16.840.1.113883.4.49"/>
     <versionNumber value="1"/>
     <recordTarget>
          <patientRole>
               <id extension="pid_123" root="2.16.840.1.113883.4.49"/>
               <patient>
                    <name>
                         <given>John</given>
                         <family>Doe</family>
                    </name>
                    <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1"/>
                    <birthTime value="19580106"/>
               </patient>
               <providerOrganization>
                    <id extension="prov_123" root="2.16.840.1.113883.4.49"/>
               </providerOrganization>
          </patientRole>
     </recordTarget>
</ClinicalDocument>
Now the same XQueries result in true.
I don't know why BEA's XQuery engine is behaving like this with namespace declaration. I want expert's help in this regard.
Thanks,
Ismail

I found that giving the full URL in declare namespace resolves my issue. Oracle's XMLPatch accepts XDiff document generated by this XQuery.

Similar Messages

  • XQuery Namespace Problem !

    Hello everyone...
    I'm trying to generate a Xdiff document using XQuery. First, i have tried to generate a static XDiff document using Xquery. I'm getting a problem with namespace. The XQuery I have written is
    select xmlroot(XMLQuery('
    declare namespace xsi="xsi"; (: :)
    declare namespace xd="xd"; (: :)
    let $chk1:=( <xd:delete-node xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]" />)
    return <xd:xdiff xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>{$chk1}</xd:xdiff>
    returning content), VERSION '1.0')
    from dual;
    The above query gives me the output
    <?xml version="1.0"?>
    <xd:xdiff xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo
    cation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>
    <xd:delete-node xmlns:xd="xd" xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]"/>
    </xd:xdiff>
    I don't want that xmlns="xd" attribute. How to eliminate that?
    Please help me.
    Thanks in advance,
    R Kaja Mohideen

    I found that giving the full URL in declare namespace resolves my issue. Oracle's XMLPatch accepts XDiff document generated by this XQuery.

  • [svn] 1313: Fix for the use namespace problems we've been having with ASC ( I hope).

    Revision: 1313
    Author: [email protected]
    Date: 2008-04-20 09:41:41 -0700 (Sun, 20 Apr 2008)
    Log Message:
    Fix for the use namespace problems we've been having with ASC (I hope). The problem was that the use directive was being defined after we had called finish package. The UseDirectiveNode has a pkgdef ptr, and does different things depending if that ptr is null or not. It should not be null when the UseDirective is inside the package - but since we were generating the UseDirectiveNode after we had called finishPackage the UseDirectiveNode didn't have it's pkgdef ptr set, and so things went awry as the package didn't get set up with all the correct open namespaces. I haven't tested this in authoring/flex but I am pretty sure that this will fix all the problems we're seeing.
    Modified Paths:
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/parser/Parser.java

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • Please help with namespace problem

    Hello,
    I am trying to display a gif image an I have a namespace problem.
    Here is my xml document:
    <?xml version='1.0'?>
    <?xml-stylesheet type="text/xsl" href="authors.xsl"?>
    <authors>
    <author>
    <name>Mike Galos</name>
    <nationality>French</nationality>
    </author>
    <author>
    <name>Cynthia Randall</name>
    <nationality>Canadian</nationality>
    </author>
    </authors>
    Here is my xsl stylesheet:
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="//author">
    <image     xmlns:xlink="http://www.w3.org/1999/xlink"
                   xlink:type="simple"
                   xlink:href="logo.gif"
                   xlink:show="embed"/>
    </xsl:template>
    </xsl:stylesheet>
    I want the browser to diplay the gif image but it is only showing the image icon and not the actual gif image.
    Can anyone please help??
    Thanks in advance,
    Balteo.

    do you use a special browser?
    if not, do you really expect a standard browser to understand this kind of non-HTML image tag?
    <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:show="embed" xlink:href="logo.gif" xlink:type="simple">check HTML 4.0 (http://www.devguru.com/Technologies/html/quickref/html_img.html)
    or XHTML(http://www.devguru.com/Technologies/xhtml/quickref/xhtml_img.html)
    for the correct tag syntax.

  • XQuery selection problem

    Hello,
    I am using the Trading Parter Management control to retrieve trading partner web binding data from the TPM repository.
    This works perfectly well but I am having some difficulty with using XQuery to get at the returned XML document. Heres the offending code:
    String nsText="declare namespace xs='http://www.bea.com/2003/03/wli/tpm'";
    String pathText="$this/web-service-binding/transport/@protocol";
    String queryText = nsText + pathText
    XmlCursor itemCursor = this.webBinding.newCursor();
    System.out.println("XML returned");
    System.out.println(itemCursor.xmlText());
    try {
    itemCursor.selectPath(queryText);
    System.out.println("Selected items: " + itemCursor.getSelectionCount());
    while (itemCursor.hasNextSelection()) {
    System.out.println(itemCursor.getTextValue())
    } catch (Exception e) {
    e.printStackTrace();
    The console output:
    HelloWorld
    XML returned
    <web-service-binding name="ACME_CORP-webservice-1" xmlns="http://www.bea.com/2003/03/wli/tpm">
    <transport protocol="http" protocol-version="1.0" endpoint="http://10.96.23.49:8080/" ti
    meout="30 seconds">
    </transport>
    </web-service-binding>
    Selected items: 0
    WLSTPI
    Hi WLSTPI From Server for wsdl client
    I am trying to select the protocol element of transport.
    I don't quite understand how I should set up the query string, I think that this is incorrect:
    String nsText="declare namespace xs='http://www.bea.com/2003/03/wli/tpm'";
    looking at the TPM.xsd the TPM namespace is xmlns="http://www.bea.com/2003/03/wli/tpm" but I have to add the "xs" to the query otherwise I get an error. Can anyone exaplain what I am doing wrong and how I get XQuery
    working.
    (Please note I can get all this working using standard Java bindings, I am interested in get this XQuery method to work as well.)
    Cheers
    Hoos
    Hussein Badakhchani
    www.orbism.com

    I can use a data transform to get at the values in the XML. This seemed to work pretty well, still if anyone can tell me how to use XQuery to do this I would be most greatful.
    Cheers
    Hussein Badakhchani
    www.orbism.com

  • Aqualogic ServiceBus tutorial, add namespace problem?

    Hi,
    I am playing around with Aqualogic ServiceBus and thought I would go
    through tutorials just to see if there is something that I don't realize
    from document (http://e-docs.bea.com/alsb/docs20/pdf/tutorial.pdf).
    On page 5-13 there is step where you are supposed to insert new
    namespace into message. On paper it seems very easy, just click + and
    type in prefix and namespace and press ok. But in reality pressing ok
    does absolutely nothing and because of this I can't insert namespace
    definition like in tutorial and everything is downhill from there...
    I am optimistic and assume that there is actually way to do what is
    described in tutorial but server just doesn't give out any error
    messages even when there is some strange step I have missed. :) Any ideas?
    jari k

    Jari Kujansuu wrote:
    Hi,
    I am playing around with Aqualogic ServiceBus and thought I would go
    through tutorials just to see if there is something that I don't realize
    from document (http://e-docs.bea.com/alsb/docs20/pdf/tutorial.pdf).
    On page 5-13 there is step where you are supposed to insert new
    namespace into message. On paper it seems very easy, just click + and
    type in prefix and namespace and press ok. But in reality pressing ok
    does absolutely nothing and because of this I can't insert namespace
    definition like in tutorial and everything is downhill from there...To answer my own message, in case others face same problem ...and to
    hear if others have same problem.
    So I looked at other things and now when returned to Aqualogic. Tried
    again and after it failed for some reason decided to test same in
    Internet Exlopder, even everything else seems to work beatifully using
    Mozilla Firefox. Well in IE when pressed OK new namespace was added as
    it should.
    Tried looking if I had some security feature turned on in Firefox but
    couldn't really see what could cause such thing. Does this work with
    Firefox for others or is this Aqualogic stuff only for Internet Exploder
    users?
    Jari Kujansuu
    Tel: +358-403400607
    [email protected]
    Endero Oyj www.endero.com
    Kiviaidankatu 2F, FI-00210 Helsinki
    The intelligent art of integration

  • Namespace problem while updating a desktop app

    Hello,
    I've searched on a lot of forums but didn't find anything accurate on my problem.
    I have an old AIR 2.0 desktop app that updated itself.
    I want to update it to the last 3.4 framework. So I followed instructions for the intermediate application to update (between 2.0 and 2.5).
    I manage to update from 2.0 to a Air 2.5 intermediate application, while still having the 2.0 namespace in the app descriptor file.
    But it is impossible for me to update this 2.5 application (with 2.0 namespace) to a 2.5 namespace !!
    Here si my update descriptor file :
    <?xml version="1.0" encoding="UTF-8"?>
    <update xmlns="http://ns.adobe.com/air/framework/update/description/2.5">
               <versionNumber>0.3.2</versionNumber>
               <versionLabel>Version for 0.3.2</versionLabel>
         <url>http://www.mywebsite/app.air</url>
         <description><![CDATA[
    Final test
               ]]></description>
    </update>
    But I'm having the error 16831 : "Application namespace and update.xml namespace are not compatible".
    It seems that my application only wants to update to another one with the exact same namespace.
    How this can be ?
    Thanks !
    I must say that I publish to AIR 2.5 with Flash CS5 and flashpro extension for air (in beta version) as Flash CS6 always overwrite the app descriptor while publishing (so it is impossible to change the namespace to 2.0 for example)

    Ok, after having searched a lot, I managed to understand what was going on....
    To those interested, the update descriptor must stay in a 1.0 namespace until the end of the process.
    When all is updated (app namespace to 2.5), you can use the 2.5 update descriptor namespace....

  • XSLT Transformer xmlns namespace problem

    Hi,
    I have the following xml document
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and the following xsl stylesheet
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    <xsl:output method = "xml" indent = "yes" />
    <xsl:template match = "/" >
    <PIPEFunctionalAcknowledgement>
              <xsl:apply-templates select="//MarketParticipantDirectory"/>
    </PIPEFunctionalAcknowledgement>
    </xsl:template>
    <xsl:template match = "MarketParticipantDirectory" >
    </xsl:template>
    </xsl:stylesheet>           
    My problem is, using JAXP1.2.0-EA2 (from JWSDP1-0-ea2), javax.xml.transform.Transformer will not find a match on the element name within the template unless I put a prefix on the target namespace i.e.
    if my xml is changed to include a prefix (:xyz in example below)
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xyz="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and my stylesheet is changed also to include the prefix
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns:xyz ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    </xsl:stylesheet>
    then the transfomer works correctly and find a match on the element name "MarketParticipantDirectory" within the template (even though the element doesn't have the prefix xyz:MarketParticipantDirectory).
    Could anyone tell me why this is the case?
    I would have expected XSLT to match the elements from the namespace xmlns ="http://www.oeb.gov.on.ca/" without the prefix.
    Any comments would be much appreciated.
    Thanks
    Sinead Casey

    Matching an element on a Default Namespace requires Explicit Prefix.
    http://www.w3.org/TR/xslt20req

  • Namespace problem with bpelx:rename typeCastTo

    Hi!
    I have j2ee web service which accepts types derived from one base type. Therefore i need to pass argument like request xsi:type="derivedType", where request is super type.
    After long searching i found out this can be done via bpelx:rename typeCastTo ... my problem is that if i use this action:
    <bpelx:rename typeCastTo="ns3:UserOutgoingCallingPlanOriginatingModifyRequest">
    <bpelx:target variable="Invoke_1_transaction_InputVariable" part="parameters" query="/ns2:transactionElement/ns2:_req"/>
    </bpelx:rename>
    in audit console after running he process i see
    <_req xmlns="http://bwproxy.unient.com/types/" xsi:type="ns3:UserOutgoingCallingPlanOriginatingModifyRequest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    but namespace prefix ns3 is nowhere defined in the message. It is defined only in source ov bpel process, but it is not propagated to the soap message, therefore web service throws a exception:
    Caught exception while handling request: unexpected element type: expected=, actual=UserOutgoingCallingPlanOriginatingModifyRequest
    Is this bug, or am i doing something wrong?
    thanks
    Tomas

    Hi,
    You could try to use HttpClient to consume wcf in windows phone 8.
    Here is an exsample you could refer:
    http://stackoverflow.com/questions/21536825/windows-phone-8-call-wcf-web-service
    Besides, you could refer to :
    http://www.codeproject.com/Questions/691619/Consuming-WCF-Service-from-Windows-Phone
    Since this issue is more related to Windows Phone, If my reply no help, please move to Windows Phone forum for a better support, It is appropriate and more experts will assist you.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Namespace problem with added header

    I have a client request handler which needs to add an authentication header of the form:
    <Security>
       <UsernameToken>
          <Username>username</Username>
          <Password>password</Password>
       </UsernameToken>
    </Security>     The key code which does this in the request handler is:
    SOAPHeaderElement she = shd.addHeaderElement(senv.createName(SIGN_HEADER_NAME));
    she.setMustUnderstand(true);
    she.addNamespaceDeclaration("", SIGN_HEADER_URI);
    SOAPElement selToken = she.addChildElement(SIGN_HEADER_TOKEN);
    SOAPElement selUser = selToken.addChildElement(SIGN_HEADER_USERNAME);
    selUser.addTextNode(username);
    selUser = selToken.addChildElement(SIGN_HEADER_PASSWORD);
    selUser.addTextNode(password);But what I end up with is:
    <Security soapenv:mustUnderstand="1" xmlns:soapenv=...
           xmlns="http://demo">
       <UsernameToken  xmlns="">
          <Username>username</Username>
          <Password>password</Password>
       </UsernameToken>
    </Security>     The attributes on the Security element are correct, but the xmlns="" attribute on the UsernameToken element is the problem. The SOAP classes/methods are clearly namespace aware and are essentially saying with xmlns="" that it doesn't know the namespace of UsernameToken and the following elements.
    I tried dropping some wsdl for the security elements in the wsdl directory of the client, but it seems to need some programmatic hookup.
    I have defined the handler in the webservicesclient.xml as:
             <handler id="Handler_1128108948956">
                <description>Adds an authentication header with username & password</description>
                <handler-name>utils.SOAP_Auth_Handler</handler-name>
                <handler-class>utils.SOAP_Auth_Handler</handler-class>
                <soap-header id="SOAPHeader_1128460509232">
                   <namespaceURI>http://demo</namespaceURI>
                   <localpart>Security</localpart>
                </soap-header>
             </handler>How do I keep the soap methods from adding on the xmlns="" to the UsernameToken element?
    I'm running WebSphere App Developer 5.0.2.9.
    Thanks,
    -- Frank

    Can't you use the removeNamespaceDeclaration method?
    public boolean removeNamespaceDeclaration(String prefix)Removes the namespace declaration corresponding to the given prefix.
    Parameters:
    prefix - a String giving the prefix for which to search
    Returns:
    true if the namespace declaration was removed successfully; false if it was not
    Gabsaga

  • A namespace problem when doing Create InfoArea in bw system

    Dear all,
    we met a problem when excute a process in our bw system:
    our process as follow:
    rsa1(Data Warehousing Workbench:Modeling) --> InfoProvider --> Create InfoArea
    then a error message window came out as below.
    error in object editing
    No valid change license available for n
    /BPR3R/
    Choose 'Display object' or 'Cancel'.
    its detail message is as follow:
    Message no. TO127
    Diagnosis
    You cannot edit the object AREA 0INDUSTRIES. This may be due to the following reasons:
    The corresponding namespace /BPR3R/ is not entered in the namespace table with a valid change license.
    In the namespace table there is no entry with a valid change license that matches the template /BPR3R/.
    System Response
    The function terminates.
    Procedure
    Check the name of the object AREA 0INDUSTRIES. If necessary, choose another object name.
    Otherwise, let the system administrator check the change licenses of the namespaces in your SAP system.
    Maintain the namespaces in the Tools of the Transport Organizer under Administration -> Display/Change Namespaces.
    You need to check and correct the entries that match the template /BPR3R/.
    You need to distinguish between the following cases:
    The namespace is /0SAP/:
    Make sure that the namespace role is C (recipient) and the flags SSCR popup and SAP standard are activated. The license fields remain empty.
    You did not create the namespace yourself. Instead, the namespace owner is SAP or another software vendor.
    Make sure that the namespace role is C (recipient). The field Repair license must either contain the valid license, or the flag SSCR popup must be activated. Contact the namespace owner and ask what you should now do, and what the valid repair license is.
    You are the namespace owner:
    Proceed according to the documentation on applying for and setting up namespaces. If the namespace role is P (producer) then you need a valid development license. For information on this, see the SAP Library under BC - Basis Components -> Change and Transport System -> BC - Namespaces and Naming Conventions -> Reservation of Namespaces).
    Then we did the below action:
    se06 --> system change option
    in this view, we found  /BPR3R/ this Prefix.
    And it is empty in  /BPR3R/ 's namespace/name range volume.
    What is next action we should take to solve this problem?
    Anyone experienced or expert,
    Please kindly give advice.
    Regards,
    Allen

    Hello Allen,
    Cold you please check the following notes which explain about this namespace creation and transport ?
    401778 - Using namespaces to develop individual BW objects
    150451 - Setting up development namespaces
    105132 - Reserving namespaces
    150451 - Setting up development namespaces
    Best regards,
    Rafa

  • Namespace problem in SRM scenario.

    Hi Experts,
    I am using the RFQ scenario on SRM (Proxy) to PI to RFC.
    The scenario is standard SRM Scenario.
    The problem is with namespace, coming from SRM Proxy is http://sap.com/xi/SRM/Sourcing/Global
    using same message Type on PI, but XML namespace here in PI is different for this message, it is http://sap.com/xi/SAPGlobal/Global
    As the namespaces are not matching, the message is in RED.
    How I can solve this ?
    Study SAP

    Hi Vijaykumar,
    Thanks for your reply.
    But it is standard proxy structure, Is it fine to modify this ?
    & it is proxy, so we have to regenerate it in SRM also.
    is it fine ?
    Study SAP

  • Xpath Namespace problem

    Hi,
    I'm facing a problem while reading an xpath element which has namespace attached.
    The xml document is as follows
    <ns0:_root  xmlns:ns0="http://www.oracle.bt.bp.osm/GPRLN">
    <ns0:Port_and_Routing_Details_g>
    <ns0:Action_Code>
    <ns0:Code1>Add</ns0:Code1>
    <ns0:Code2>Delete</ns0:Code2>
    <ns0:Code3>Update</ns0:Code3>
    </ns0:Action_Code>
    </ns0:Port_and_Routing_Details_g>
    <ns0:Extended_Quantity>1</ns0:Extended_Quantity>
    <ns0:Status>Pending</ns0:Status>
    <ns0:Description/>
    </ns0:_root> In the above xml document i want to capture the text node of <ns0:Code3>Update</ns0:Code3> i.e. I want to get Update as a result.
    I'm using the following java program to to get the value by using xpath but not succeeded.
    public class XMLParsing {
         public static void main(String[] args)
             try {
                       DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
             domFactory.setNamespaceAware(true);
             DocumentBuilder builder = domFactory.newDocumentBuilder();
             Document doc = builder.parse("E:\\sample.xml");
             XPathFactory factory = XPathFactory.newInstance();
             XPath xpath = factory.newXPath();
              XPathExpression fax = xpath.compile("//ns0:Port_and_Routing_Details_g/ns0:Action_Code/ns0:Code3/text()");
                        Object result = fax.evaluate(doc, XPathConstants.NODESET);
              NodeList nodes = (NodeList) result;
              int len = nodes.getLength();
              System.out.println(len);
              for (int i=0; i<len;i++){
                   System.out.println(nodes.item(i).getNodeValue());
             catch (ParserConfigurationException e) {
              e.printStackTrace();
              catch(SAXException e){
                   e.printStackTrace();
              catch(IOException e) {
                   e.printStackTrace();
              catch(XPathExpressionException e){
                   e.printStackTrace();
      }Anybody please help me on this issue
    Thanks

    Hi,
    put bolded code in your program.
    It will resolve your problem
    public class XMLParsing {
         public static void main(String[] args)
         try {
    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         domFactory.setNamespaceAware(true);
         DocumentBuilder builder = domFactory.newDocumentBuilder();
         Document doc = builder.parse("E:\\sample.xml");
    *NamespaceContext ctx = new NamespaceContext() {*
    *public String getNamespaceURI(String prefix) {*
    String uri;
    if (prefix.equals("ns0"))
    uri = "http://www.oracle.bt.bp.osm/GPRLN";
    else if (prefix.equals("ns2"))
    uri = "http://www.davber.com/sales-format";
    else
    uri = null;
    return uri;
    *public Iterator getPrefixes(String val) {*
    *     return null;*
    *// Dummy implemenation - not used!*
    *public String getPrefix(String uri) {*
    return null;
         XPathFactory factory = XPathFactory.newInstance();
         XPath xpath = factory.newXPath();
    xpath.setNamespaceContext(ctx);
         XPathExpression fax = xpath.compile("//ns0:Port_and_Routing_Details_g/ns0:Action_Code/ns0:Code3/text()");
    Object result = fax.evaluate(doc, XPathConstants.NODESET);
              NodeList nodes = (NodeList) result;
              int len = nodes.getLength();
              System.out.println(len);
              for (int i=0; i<len;i++){
                   System.out.println(nodes.item(i).getNodeValue());
         catch (ParserConfigurationException e) {
              e.printStackTrace();
              catch(SAXException e){
                   e.printStackTrace();
              catch(IOException e) {
                   e.printStackTrace();
              catch(XPathExpressionException e){
                   e.printStackTrace();
    }

  • Delete(xml) in Flex namespace problem

    hihi
    I have problem with AS3 xml
    I want delete nodes in the folowing XML, which has title
    "undefined". A sample from the xml:
    <xml>
    <page>
    <title>Szabályalapú
    reprezentáció</title>
    <id>tudásterület_74</id>
    <revision>
    <id>1</id>
    <timestamp>2008-05-27T09:58:13Z</timestamp>
    <contributor>
    <ip>Wikiadmin</ip>
    </contributor>
    <text aaa:space="preserve"></text>
    </revision>
    </page>
    <page>
    <title>undefined</title>
    <id>tudásterület_22</id>
    <revision>
    <id>1</id>
    <timestamp>2008-05-27T09:58:13Z</timestamp>
    <contributor>
    <ip>Wikiadmin</ip>
    </contributor>
    <text aaa:space="preserve"></text>
    </revision>
    </page>
    <page>
    <title>Döntési folyamat</title>
    <id>tudásterület_22</id>
    <revision>
    <id>1</id>
    <timestamp>2008-05-27T09:58:13Z</timestamp>
    <contributor>
    <ip>Wikiadmin</ip>
    </contributor>
    <text aaa:space="preserve"></text>
    </revision>
    </page>
    </xml>
    I tried this script but didnt worked:
    delete xml.*::page.(title=="undefined")
    In a basic this shuold be like:
    delete xml.page.(title=="undefined")
    How does it work in xmls with namespace?

    "rtalton" <[email protected]> wrote in
    message
    news:gecgfa$3rs$[email protected]..
    > Sure thing. I tried to find a one-line method but
    couldn't. E4x syntax
    > supports
    > filtering using expressions, but not the delete command
    as far as I could
    > tell.
    > Maybe someone else knows more. Good luck.
    I think the problem is the filter expression returns an
    XMLList. You can
    only delete a single node. So try:
    delete yourNodesFilteredByExpression[0];
    HTH;
    Amy

  • Namespace problem The result is empty for the XPath expression

    I have a problem with BPEL namespaces. The webservice that my BPEL process is using has changed namespaces (i.e. the java code package names changed and therefore the namespaces associated with the packages.)
    Before there was only one namespace associated with this web services; now there are multiple namespaces.
    I have changed the namespaces in my .bpel file; however I get the result is empty for XPath expression:
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    Any help appreciated...:(

    hey b-o-s-t-o-n,
    have your verified that the namespace import is correct, and with the right prefix
    you xpath contains 2 namespace prefixes
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    so check the bpel file and maybe the wsdl that has been generated (that inclused the plnk extensions for your external service)
    this is the most common issue ..
    hth clemens

Maybe you are looking for

  • How to resize the spark datagrid collumns based on the headertext?

    Hi friends,      I am using spark datagrid for displaying the tablur data in my application, when i setting the dataprovider property of the datagrid, it displays the content exactally what i expeceted. but the widht of the collumns are based on the

  • Built-in iSight not recognized

    If I boot up my mac and start photobooth straight away, I get the message: "Photo Booth cannot open because no camera is attached or the camera is in use by another application - Make sure your digital video camera is properly attached and turned on.

  • Batch resizing images, etc. not as an export

    What I'd like to do is take all the images in a catalog, resize them into tiny thumbnails, place those thumbnails in some directory, and then FTP them to a web server.  Some of this is covered under the SDK's "export" functionality, but what I'm prop

  • Wifi doesn't work with the case, iPhone 5

    I see a lot of complains about wifi problems, but anyone having problem like mine?  I have iPhone 5 (1mine, 1 wife), we didn't get wifi signal at all when we have the cases on.  However, when I did the test on both like taking the case off on one and

  • Newbie to servlet programming - please help!

    Hi everyone, My brother and I would like to get into programming multiplayer games online (in Java, preferrably). Is this the specific forum I should use to post any questions I have? Also, can anyone recommend any books which are newer and cover mul