XMLBEANS | Namespace problem

Hi,
My Xml elements has multiple namespaces, following is a sample of my xml:
<?xml....?>
<w:ABCD>
<xmlns:w="urn:schemas-xxx-com:xx", xmlns:x="urn:schemas-xxx-com:xx:xx", xmlns:y="http://schemas.xxx.com/schemaLibrary/xx/xxx"/>
<w:myElement1>Some Text</w:myElement1>
<x:myElement2>New Text</x:myElement2>
<y:myElement3>More Text</y:myElement3>
<w:myElement4>Another Text</w:myElement4>
</w:ABCD>
I have multiple schema files (.xsd's) that I was able to compile and then everything looks fine and dandy, able to open a xml document using the following common xmlbeans way,
ABCDElem abcdObj = ABCDElem.Factory.parse(myXml);
I get the whole xml string back from abcdObj object when I print this.
But I can't get any child nodes from abcdObj which is on a different namespace with a simple get...., so I used the following code to get child elements,
XmlObject[] xs = abcd.selectChildren("urn:schemas-xxx-com:xx:xx","myElement2");
Then I have to get the individual objects like,
MyElement2 e1 = MyElement2.Factory.parse(xs[0].newReader());
Now I am able to get the text from the elements, but when I am updating some text, and printing the abcdObj, I am not getting the updated value, it still returns me the old xml back, then I tried to set the objects back,
abcdObj.set(e1); so on and so forth....
Then I get the following exception,
org.apache.xmlbeans.impl.values.XmlValueDisconnectedException
Any idea? Appreciate your help.

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

Similar Messages

  • [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.

  • 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

  • WSDL Webservices namespace problem

    Hi
    I am trying to test a simple webservice deployed on Composite server. So I imported the wsdl and generated the XMLBeans and Service Control and tested the service control. When I test it I can see the SOAP response has the expected data but the XMLBeans are not populated which when i tried to print returns NULL.
    I have feeling this has to do with namespaces here is the WSDL: Please look at the following WSDL and response that I am getting. I think the response I am getting should have namespace ns2 instead of ns1.
    Please help!
    <wsdl:definitions
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:ns2="http://MXL43805BZ.netnumina.com/services/webservices/Products"
    xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="http://MXL43805BZ.netnumina.com/services/webservices/Products">
         <wsdl:types>
              <xs:schema targetNamespace="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                   <xs:complexType name="products">
                        <xs:sequence>
                             <xs:element name="row" minOccurs="0" maxOccurs="unbounded">
                                  <xs:complexType>
                                       <xs:sequence>
                                            <xs:element name="ProductID" type="xs:decimal"/>
                                            <xs:element name="ProductName" type="xs:string"/>
                                            <xs:element name="ProductDescription" type="xs:string"/>
                                            <xs:element name="CategoryID" type="xs:decimal"/>
                                            <xs:element name="SerialNumber" type="xs:string"/>
                                            <xs:element name="UnitPrice" type="xs:decimal"/>
                                            <xs:element name="ReorderLevel" type="xs:decimal"/>
                                            <xs:element name="LeadTime" type="xs:string"/>
                                       </xs:sequence>
                                  </xs:complexType>
                             </xs:element>
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="ProductDetailsResponse">
                        <xs:sequence>
                             <xs:element name="products" type="ns1:products"/>
                        </xs:sequence>
                   </xs:complexType>
              </xs:schema>
         </wsdl:types>
         <wsdl:message name="GetProductDetailsProductDetailsSoapOut">
              <wsdl:part name="parameters" type="ns2:ProductDetailsResponse"/>
         </wsdl:message>
         <wsdl:message name="GetProductDetailsProductDetailsSoapIn">
         </wsdl:message>
         <wsdl:portType name="GetProductDetailsType">
              <wsdl:operation name="ProductDetails">
                   <wsdl:input message="ns2:GetProductDetailsProductDetailsSoapIn"/>
                   <wsdl:output message="ns2:GetProductDetailsProductDetailsSoapOut"/>
              </wsdl:operation>
         </wsdl:portType>
         <wsdl:binding name="GetProductDetailsBinding" type="ns2:GetProductDetailsType">
              <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
              <wsdl:operation name="ProductDetails">
                   <soap:operation soapAction="ProductDetails" style="rpc"/>
                   <wsdl:input>
                        <soap:body use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                        <soap:body use="literal"/>
                   </wsdl:output>
              </wsdl:operation>
         </wsdl:binding>
         <wsdl:service name="ProductDetailsService">
              <wsdl:port name="GetProductDetails" binding="ns2:GetProductDetailsBinding">
                   <soap:address location="http://MXL43805BZ.netnumina.com:9400/services/Products/ProductDetailsService/GetProductDetails.ws"/>
              </wsdl:port>
         </wsdl:service>
    </wsdl:definitions>
    and here is the response:
    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap-env:Body>
    <ns1:ProductDetailsResponse xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">
    <ns1:ProductDetails xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">
    <ns1:row xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">
    <ns1:ProductID xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">1</ns1:ProductID>
    <ns1:ProductName xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">Maxtific 40GB ATA133 7200</ns1:ProductName>
    <ns1:ProductDescription xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">Maxtific Storage 40 GB</ns1:ProductDescription>
    <ns1:CategoryID xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">1</ns1:CategoryID>
    <ns1:SerialNumber xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">221-887-3458</ns1:SerialNumber>
    <ns1:UnitPrice xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">89.99</ns1:UnitPrice>
    <ns1:ReorderLevel xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">20</ns1:ReorderLevel>
    <ns1:LeadTime xmlns:ns1="http://MXL43805BZ.netnumina.com/services/webservices/Products/ProductDetailsService/GetProductDetails">14 Days</ns1:LeadTime>
    </ns1:row>
    </ns1:ProductDetails>
    </ns1:ProductDetailsResponse>
    </soap-env:Body>
    </soap-env:Envelope>
    -------------------------------------------

    If I have understood your query correctly, you need to change the QName of the eBookProjectRoot to QName("ns1","ebookProjectRoot").
    Hope this helps,
    Balakrishnan V

  • 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

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

  • Saaj namespace problem

    Hi,
    I am trying to using saaj to create ebXML soap message. I have two problems:
    1) I cannot change the prefix of the Envelope, Header etc. I would like SOAP instead of soapenv.
    2) More importantly, it repeats the namespace uri on each element, which is not necessary as it is declared in a parent element.
    Example soap message from code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmls
    oap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP="http://schemas.xmlsoap.or
    g/soap/envelope" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema
    /mgs-header-2_0.xsd">
    <soapenv:Header>
    <eb:MessageHeader xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/sch
    ema/mgs-header-2_0.xsd">
    <eb:From xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/mgs-
    header-2_0.xsd">
    <eb:PartyId xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/
    mgs-header-2_0.xsd"/>
    </eb:From>
    </eb:MessageHeader>
    </soapenv:Header>
    <soapenv:Body/>
    I would like:
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmls
    oap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP="http://schemas.xmlsoap.or
    g/soap/envelope" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema
    /mgs-header-2_0.xsd">
    <SOAP:Header>
    <eb:MessageHeader>
    <eb:From>
    <eb:PartyId/>
    </eb:From>
    </eb:MessageHeader>
    </SOAP:Header>
    <SOAP:Body/>
    Following is my code:
    SOAPConnectionFactory connFactory = SOAPConnectionFactory.newInstance();
         SOAPConnection connection = connFactory.createConnection();
              SOAPMessage message = MessageFactory.newInstance().createMessage();
              SOAPPart soapPart = message.getSOAPPart();
              SOAPEnvelope envelope = soapPart.getEnvelope();
              envelope.setPrefix("SOAP");
              envelope.addNamespaceDeclaration("SOAP", "http://schemas.xmlsoap.org/soap/envelope");
              envelope.addNamespaceDeclaration("eb", "http://www.oasis-open.org/committees/ebxml-msg/schema/mgs-header-2_0.xsd");
              SOAPFactory soapFactory = SOAPFactory.newInstance();
              Name messageHeader = soapFactory.createName("MessageHeader","eb","http://www.oasis-open.org/committees/ebxml-msg/schema/mgs-header-2_0.xsd");
              SOAPHeader header = message.getSOAPHeader();
              SOAPHeaderElement headerElement = header.addHeaderElement(messageHeader);
              SOAPElement from = headerElement.addChildElement("From", "eb");
              from.addChildElement("PartyId", "eb");
              SOAPElement to = headerElement.addChildElement("To", "eb");
              to.addChildElement("PartyId", "eb");
    Any ideas?
    Many thanks for anyone able to help with this.

    Axis that is part of jboss web services. Looks like it is an axis issue, but I must point out that the messageas are valid - just a little verbose.

Maybe you are looking for