Oracle9i XMLType and namespace declaration

Hi Folks,
I am using the new XMLType for storing XML data and when I want to insert a XML document that contains a namespace declaration
using sys.XMLType.createXML('<lom xmlns="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1"...>...</lom>') function, nothing is inserted into the field and no error message is shown. If I remove the namespace declaration like: sys.XMLType.createXML('<lom>...</lom>') then it works.
I am wondering if there is a problem with the XML Parser or I should do something that I don't. I have read most of the online documents in this regard but couldn't find any answer.
Your help is really appreciated.
Bahram Jalili

I ran into the same (almost) problem a few weeks ago and posted a question to this forum - no response... sigh. Seems like a pretty obvious bug.

Similar Messages

  • Add a root node and namespace declaration

    According to the requirement,I have a large appended .txt file.
    This .txt file is created by appending various xml files (without the namespace and root node).
    I need to add a root node and namespace declaration to the large appended .txt file so that it can be read as .xml.
    Please provide the pointers for the same.
    Thanks & Regards,
    Rashi

    My appended file looks like following.
    <input>
       <Store>
          <StoreHeader>
             <StoreNbr>56</StoreNbr>
             <StoreType>Retail</StoreType>
             <StoreSite>2004</StoreSite>
          </StoreHeader>
          <Transactions>
             <Transaction>
                <Item>A</Item>
                <ItemPrice>4</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>C</Item>
                <ItemPrice>56</ItemPrice>
             </Transaction>
          </Transactions>
       </Store>
    </input>
    <input>
       <Store>
          <StoreHeader>
             <StoreNbr>123</StoreNbr>
             <StoreType>Retail</StoreType>
             <StoreSite>2004</StoreSite>
          </StoreHeader>
          <Transactions>
             <Transaction>
                <Item>A</Item>
                <ItemPrice>4</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>B</Item>
                <ItemPrice>8</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>C</Item>
                <ItemPrice>56</ItemPrice>
             </Transaction>
          </Transactions>
       </Store>
    </input>
    Now according to the requirement, I need to add namespace and root node and make it like follows:
    <ns0:output xmlns:ns0="http://xxx">
       <input>
       <Store>
          <StoreHeader>
             <StoreNbr>56</StoreNbr>
             <StoreType>Retail</StoreType>
             <StoreSite>2004</StoreSite>
          </StoreHeader>
          <Transactions>
             <Transaction>
                <Item>A</Item>
                <ItemPrice>4</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>C</Item>
                <ItemPrice>56</ItemPrice>
             </Transaction>
          </Transactions>
       </Store>
    </input>
    <input>
       <Store>
          <StoreHeader>
             <StoreNbr>123</StoreNbr>
             <StoreType>Retail</StoreType>
             <StoreSite>2004</StoreSite>
          </StoreHeader>
          <Transactions>
             <Transaction>
                <Item>A</Item>
                <ItemPrice>4</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>B</Item>
                <ItemPrice>8</ItemPrice>
             </Transaction>
             <Transaction>
                <Item>C</Item>
                <ItemPrice>56</ItemPrice>
             </Transaction>
          </Transactions>
       </Store>
    </input>
    </ns0:output>

  • Problems with XMLType and namespace

    Dear subscribers:
    I have been using XMLType successfully with simple XMLs - without namespaces. Now I must handle messages with "xmlns" and it seems XMLType is failing.
    I tested the following XML, extracted from w3c.org examples:
    <?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>
    The result of “xmlt.getRootElement()” is “book”.
    However, the use of “xmlt.extract( 'book' )” returns an empty object:
    xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() );
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    The following usages also raise errors:
    xmlt1 := xmlt.extract( 'bk:book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk:book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'bk::book' );
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00601: Invalid token in: 'bk::book' ORA-06512: at "SYS.XMLTYPE", line 111
    xmlt1 := xmlt.extract( 'book', 'bk' );
    ORA-31013: Invalid XPATH expression ORA-06512: at "SYS.XMLTYPE", line 119
    I am using Oracle version 10.2.0.1.0. Had someone also faced this problem?
    The code I used to test is at the end of this message.
    Thanks in advance
    ====================================
    DECLARE
    xml varchar2(32000);
    xmlt XMLType;
    xmlt1 XMLType;
    root varchar2(3000);
    BEGIN
    --Example from w3c.org
    xml := '<?xml version="1.0"?>
    <bk:book xmlns:bk=''urn:loc.gov:books''
    xmlns:isbn=''urn:ISBN:0-395-36341-6''>
    <bk:title>Cheaper by the Dozen</bk:title>
    <isbn:number>1568491379</isbn:number>
    </bk:book>';
    xmlt := XMLType( xml );
    root := xmlt.getRootElement();
    dbms_output.put_line( 'StringVal: ' || xmlt.getStringVal() ); -- The XML is ok…
    dbms_output.put_line( 'Namespace: ' || xmlt.getNameSpace() ); -- Returns NULL
    dbms_output.put_line( 'Root element: ' || root ); -- Returns ‘book’
    dbms_output.put_line( 'Exists: ' || xmlt.existsNode('book') ); -- Returns ZERO
    xmlt1 := xmlt.extract( 'bk:book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'bk::book' ); Raises error (see above)
    xmlt1 := xmlt.extract( 'book', 'bk' ); Raises error (see above)
    --xmlt1 := xmlt.extract( 'book' );
    dbms_output.put_line( 'StringVal: ' || xmlt1.getStringVal() ); Raises error
    END;
    /

    If you put your XML into a namespace then you also need to extract from that namespace.... e.g.
    No namespace...
    SQL> select t.xml.extract('myroot')
    2 from (select XMLTYPE('<myroot><mychild>test</mychild></myroot>') as xml from dual) t
    3 ;
    T.XML.EXTRACT('MYROOT')
    <myroot>
    <mychild>test</mychild>
    </myroot>Put XML in namespace and now the extract returns nothing...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    3 /
    T.XML.EXTRACT('MYROOT')
    --------------------------------------------------------------------------------------------------------Extract, specifying the namespace to extract from and now returns the result...
    SQL> ed
    Wrote file afiedt.buf
    1 select t.xml.extract('myroot', 'xmlns="fred"')
    2* from (select XMLTYPE('<myroot xmlns="fred"><mychild>test</mychild></myroot>') as xml from dual) t
    SQL> /
    T.XML.EXTRACT('MYROOT','XMLNS="FRED"')
    <myroot xmlns="fred">
    <mychild>test</mychild>
    </myroot>
    SQL>;)

  • Namespace declaration and W3C standart

    Hello,
    W3C has following specs for Namespace declaration in XQuery:
    http://www.w3.org/TR/xquery/#id-namespace-decls
    "[117]      NamespaceDecl      ::=      "declare" "namespace" NCName "=" StringLiteral
    A namespace declaration declares a namespace prefix and associates it with a namespace
    URI, adding the (prefix, URI) pair to the set of in-scope namespaces. The string
    literal used in a namespace declaration must be a valid URI, and may not be a
    zero-length string.[err:XQ0046] The namespace declaration is in scope throughout
    the query in which it is declared, unless it is overridden by a namespace declaration
    attribute in an element constructor.
    The following query illustrates a namespace declaration:
    declare namespace foo = "http://example.org";
    <foo:bar> Lentils </foo:bar> "
    BNF production grammar requires "declare" token to be placed before namespace,
    while
    Liquid Data reports parsing error if the word is there.
    How close Liquid Data XQuery grammar to the W3C standart?
    Also, does "of type" exist in XQuery ?
    Sincerely,
    Benjamin.

    Thank you for quick answer.
    Sorry, my fault - didn't notice that fact.
    Benjamin.
    "Mike Reiche" <mreiche@news_group_only.com> wrote:
    LD 8.1 was released in July 2003 (before the August 2003 spec). It adheres
    to
    http://www.w3.org/TR/2001/WD-xquery-20011220/#id-namespace-decls-and-schemas
    http://e-docs.bea.com/liquiddata/docs81/prodover/concepts.html
    - Mike Reiche
    "Benjamin Shrom" <[email protected]> wrote:
    Hello,
    W3C has following specs for Namespace declaration in XQuery:
    http://www.w3.org/TR/xquery/#id-namespace-decls
    "[117]      NamespaceDecl      ::=      "declare" "namespace" NCName
    "=" StringLiteral
    A namespace declaration declares a namespace prefix and associates it
    with a namespace
    URI, adding the (prefix, URI) pair to the set of in-scope namespaces.
    The string
    literal used in a namespace declaration must be a valid URI, and may
    not be a
    zero-length string.[err:XQ0046] The namespace declaration is in scope
    throughout
    the query in which it is declared, unless it is overridden by a namespace
    declaration
    attribute in an element constructor.
    The following query illustrates a namespace declaration:
    declare namespace foo = "http://example.org";
    <foo:bar> Lentils </foo:bar> "
    BNF production grammar requires "declare" token to be placed beforenamespace,
    while
    Liquid Data reports parsing error if the word is there.
    How close Liquid Data XQuery grammar to the W3C standart?
    Also, does "of type" exist in XQuery ?
    Sincerely,
    Benjamin.

  • JSP documents and namespaces

    I have an issue involving JSP documents (i.e. JSP pages that are
              well-formed XML documents). I am using namespaces on children elements
              of the <jsp:root> element, because my JSP page generates XML with
              namespaces. The simple fragment below illustrates this:
              <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              version="1.2">
              <d:document xmlns:d="http://example.org/xml/document">
              <d:head>
              <d:title>Example</d:title>
              </d:head>
              <d:body>
              Some Text.
              </d:body>
              </d:document>
              </jsp:root>
              This example works with Tomcat 4 and Tomcat 5, but fails with WL
              8.1. I get an error like this:
              /example/my.jsp(20): no corresponding open tag for tag extension
              close: //[ ; Line: 20]
              probably occurred due to an error in /example/my.jsp line 20:
              </d:document>
              This seems to be a bug in the WebLogic JSP implementation. It should
              be possible to generate XML documents containing namespaces. The JSP
              1.2 spec is actually silent on this, but it says (JSP.5.2.2):
              "the root is where namespace attributes of taglibs will be inserted.
              All tag libraries used within the JSP document are represented in the
              root element through additional xmlns attributes."
              This to me implies that namespace declarations occurring elsewhere in
              the document are not interpreted as tag libs and therefore should be
              handled like regular tags.
              Any help is appreciated.
              -Erik
              

              "Erik Bruchez" <[email protected]> wrote in message
              news:[email protected]...
              > Thanks Nagesh,
              >
              > In passing, looking at the latest JSP 2.0 spec, I found out that there
              > may be an additional issue in the future, as the 2.0 spec allows for
              > tag libraries namespace declarations everywhere in the document. How
              > are you going to be able to generate XML documents with namespaces if
              > every namespace is necessarily bound to a tag library? The spec does
              > not seem to address this at all. I have emailed my feedback to the
              > JSR, but it would be interesting to have the opinion of WebLogic
              > developers on this.
              >
              > -Erik
              As far as i can remember, this doesn't restrict the namespaces in themselves
              i.e not attached to any taglibs. Given a namespace which is not resolved as
              a taglib, it will be considered a standard namespace no? .. Am i missing
              something. Also which section and which PFD version of the spec are you
              looking at? It would be great if you can give a little more detail about the
              issue so it can be fixed in the spec if possible..
              I would also be interested in knowing how you are using the Jsp documents
              (in xml format) in general. (since I'm trying to get an insight into the
              various ways in which jsp Docs are being used by customers)
              Nagesh
              >
              > Nagesh Susarla <[email protected]> wrote in message
              news:<[email protected]>...
              > > Hi Erik,
              > >
              > > Indeed this does look like a bug in the wls jsp container. Attributes
              > > with ':' in them are not being lexed correctly. I've opened CR111972 to
              > > track this issue, so please contact [email protected] for necessary
              patches.
              > >
              > > thanks
              > > Nagesh
              > >
              > > Erik Bruchez wrote:
              > > > I have an issue involving JSP documents (i.e. JSP pages that are
              > > > well-formed XML documents). I am using namespaces on children elements
              > > > of the <jsp:root> element, because my JSP page generates XML with
              > > > namespaces. The simple fragment below illustrates this:
              > > >
              > > > <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
              > > > version="1.2">
              > > > <d:document xmlns:d="http://example.org/xml/document">
              > > > <d:head>
              > > > <d:title>Example</d:title>
              > > > </d:head>
              > > > <d:body>
              > > > Some Text.
              > > > </d:body>
              > > > </d:document>
              > > > </jsp:root>
              > > >
              > > > This example works with Tomcat 4 and Tomcat 5, but fails with WL
              > > > 8.1. I get an error like this:
              > > >
              > > > /example/my.jsp(20): no corresponding open tag for tag extension
              > > > close: //[ ; Line: 20]
              > > > probably occurred due to an error in /example/my.jsp line 20:
              > > > </d:document>
              > > >
              > > > This seems to be a bug in the WebLogic JSP implementation. It should
              > > > be possible to generate XML documents containing namespaces. The JSP
              > > > 1.2 spec is actually silent on this, but it says (JSP.5.2.2):
              > > >
              > > > "the root is where namespace attributes of taglibs will be inserted.
              > > > All tag libraries used within the JSP document are represented in the
              > > > root element through additional xmlns attributes."
              > > >
              > > > This to me implies that namespace declarations occurring elsewhere in
              > > > the document are not interpreted as tag libs and therefore should be
              > > > handled like regular tags.
              > > >
              > > > Any help is appreciated.
              > > >
              > > > -Erik
              

  • Avoid repeating namespace declaration in xml output

    Hi all,
    I'm trying an IDoc -> XML File (specifically UBL-format) scenario, and it is working fine. But the resulting XML contains repeating namespace declarations for each element, instead of a "common" declaration at the root element.
    How can I avoid this, so the message contains the namespace declarations in root node, and only uses the namespace prefix for each element?
    The target format, external definition, is an XSD with several import statements, and all external references have been set up, meaning all referenced XSD's are imported too, and have the "Source"-field set according to the import statement.
    Sample result file (top of file only):
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Invoice xmlns:ns0="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <ns2:UBLVersionID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2.0</ns2:UBLVersionID>
    <ns2:CustomizationID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:transaction:BiiCoreTrdm001:ver1.0:extentionId</ns2:CustomizationID>
    <ns2:ProfileID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">urn:www.cenbii.eu:profile:bii05:ver1.0</ns2:ProfileID>
    <ns2:ID xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">9010045446</ns2:ID>
    <ns2:IssueDate xmlns:ns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">2011-04-19</ns2:IssueDate>
    <ns2:InvoiceTypeCode...
    PI version 7.11.
    Thanks for all help.
    Br,
    Kenneth

    Hi Mon,
    You can use below xslt 1.0 mappings.
    The first one will copy all namespaces (declared) to a newly created root element.
    The seconde one will delete the 'old' root element.
    => The result will look like an xml where the namespacesare moved to the root element.
    First xslt:
    <?xml version='1.0' encoding='utf-8'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8"/>
    <xsl:template match="/">
    <Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns1="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:ns3="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ns4="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
    <xsl:copy-of select="." />
    </Invoice>
    </xsl:template>
    </xsl:stylesheet>
    Second xslt:
    <?xml version='1.0' encoding='utf-8'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8"/>
    <xsl:template match="@* | node()">
      <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="Invoice" >
      <xsl:apply-templates/>
    </xsl:template>
    </xsl:stylesheet>
    Kind regards,
    Lode

  • RFC Call: Missing namespace declaration

    Dear experts,
    I have a file to RFC scenario. I imported the RFC and create files exactly according to the RFC structure, so I don't use a mapping. When I create a file, it provides the following error in the adapter log:
    <i>Exception caught by adapter framework: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: could not get functionname from XML requst: com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declaration(2)</i>
    What do I need to do to fix this.
    Thanks in advance!

    This is the whole message:
    I created my own interface and mapped it to the RFC:
    This is the message. Now it successfully pass XI and the adapter sais it is delivered.
    BUT nothing is seen in the target system... how is that possible???
    <?xml version="1.0" ?>
    <ns:MT_TO_CREATE xmlns:ns="urn://cchbc/w2/xi/mes/warehousetransfer">
    <LGNUM></LGNUM>
    <TIMEST>20071207094550.0000000</TIMEST>
    <WERKS>4510</WERKS>
    <ZLAST>0</ZLAST>
    <ZSCID>SCANPRD4</ZSCID>
    <I_LTAP>
    <item>
    <EAN11>5449000003096</EAN11>
    <LETYP>E2</LETYP>
    <VSOLM>48.000</VSOLM>
    <LENUM>00345101239500010930</LENUM>
    <VFDAT>2008-12-11T00:00:00</VFDAT>
    <WDATU>2007-12-07</WDATU>
    <ZLINE>830</ZLINE>
    <ZTIME>09:43:32</ZTIME>
    <BRGEW/>
    </item><item>
    <EAN11>2229000058744</EAN11>
    <LETYP>E2</LETYP>
    <VSOLM>48</VSOLM>
    <LENUM>00000000003000002961</LENUM>
    <VFDAT>2008-12-11T00:00:00</VFDAT>
    <WDATU>2007-12-07</WDATU>
    <ZLINE>830</ZLINE>
    <ZTIME>09:44:01</ZTIME>
    <BRGEW/></item><item>
    <EAN11>2229000058744</EAN11>
    <LETYP>E2</LETYP>
    <VSOLM>48.000</VSOLM>
    <LENUM>00000000003000002978</LENUM>
    <VFDAT>2008-12-11T00:00:00</VFDAT>
    <WDATU>2007-12-07</WDATU>
    <ZLINE>830</ZLINE>
    <ZTIME>09:44:32</ZTIME>
    <BRGEW/></item></I_LTAP></ns:MT_TO_CREATE>
    And the output is:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:ZWM_TO_CREATE xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
      <LGNUM />
      <TIMEST>20071207094550.0000000</TIMEST>
      <WERKS>4510</WERKS>
      <ZLAST>0</ZLAST>
      <ZSCID>SCANPRD4</ZSCID>
    - <I_LTAP>
    - <item>
      <EAN11>5449000003096</EAN11>
      <LETYP>E2</LETYP>
      <VSOLM>48.000</VSOLM>
      <LENUM>00345101239500010930</LENUM>
      <VFDAT>2008-12-11T00:00:00</VFDAT>
      <WDATU>2007-12-07</WDATU>
      <ZLINE>830</ZLINE>
      <ZTIME>09:43:32</ZTIME>
      <BRGEW />
      </item>
    - <item>
      <EAN11>2229000058744</EAN11>
      <LETYP>E2</LETYP>
      <VSOLM>48</VSOLM>
      <LENUM>00000000003000002961</LENUM>
      <VFDAT>2008-12-11T00:00:00</VFDAT>
      <WDATU>2007-12-07</WDATU>
      <ZLINE>830</ZLINE>
      <ZTIME>09:44:01</ZTIME>
      <BRGEW />
      </item>
    - <item>
      <EAN11>2229000058744</EAN11>
      <LETYP>E2</LETYP>
      <VSOLM>48.000</VSOLM>
      <LENUM>00000000003000002978</LENUM>
      <VFDAT>2008-12-11T00:00:00</VFDAT>
      <WDATU>2007-12-07</WDATU>
      <ZLINE>830</ZLINE>
      <ZTIME>09:44:32</ZTIME>
      <BRGEW />
      </item>
      </I_LTAP>
      </ns1:ZWM_TO_CREATE>

  • How to remove SOAP namespaces declarations in body content?

    Hi!
    I'm calling a WS with WS-Security without problems but when I extract the content the SOAP message's Body(the "business" part), the namespace declarations of the SOAP part (envelope, security, etc.) are present in the root element. However, any of this namespaces is referenced in the message that I extract.
    I'm extracting the message inside the body like this
    XmlObject[] aXml = xml.selectPath(##THE QUERY##);
    return XmlObject.Factory.parse(aXml[0].xmlText(_opts));
    Is there a way of getting rid of these declarations?
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    I've tried changing the XmlOptions (setSaveAggresiveNamespaces, setLoadSubstituteNamespaces, etc.) without success.
    Thanks in advance!

    just use $body/* and you will have what u wanted.

  • E4X and Namespaces - How best to handle?

    Hi,
    I need to use E4X to create a list of nodes of a particular type from an xml document returned form a Web Service. The document uses multiple namespaces, so I can't access its content, event nodes which aren't prefixed with a namespace.
    I can get round this problem by using:
    namespace all = "http://www.w3.org/2005/Atom"
    use namespace all;
    in the class which parses out the nodes, however, I want to wrap the nodes in an XMLListCollection and set them as a list's dataProvider, and becuase the node's themselves have namespaces declared, it seems that the list can't access the nodes (which all have a label property) and displays the whole node instead.
    What is the correct way to handle this situation?
    Thanks.

    Hi Alex,
    Thanks for the reply. Overlooked that completely.

  • Retrieve namespace  declarations from unmarshalled object

    Hi,
         I hope this is a beginner's question:
    Still working on a web service, that uses an EJB for implementation. I'm using types/classes that were derived automatically from a WSDL (top-down/outside-in/what have you), or rather the corresponding schemata. I'm trying to retrieve namespace declarations from the unmarshalled object/element, but  they are not contained in the "otherAttributes" [Map<QName, String>] member field of the respective object. However, I can retrieve any other attribute, qualified and non qualified, as long as the namespace isn't that of xmlns (http://www.w3.org/2000/xmlns/). For example:
    Client:
                MyElement my_element = new MyElement();
                Map<QName, String> atts = my_element.getOtherAttributes();
                QName ns_att = new QName("http://www.w3.org/2000/xmlns/", "a");
                atts.put(ns_att, "http://www.example.com/");
                QName test_att = new QName("test-att");
                atts.put(test_att, "http://www.example2.com");
    Service:
                MyElement my_element = parent.getMyElement(); // ...
                Map<QName, String> atts = my_element.getOtherAttributes();
                for (QName qn :  atts.keySet()) {
                    System.out.println("qn: ["+qn+"] value["+atts.get(qn)+"]");
    This would print:
    qn: [test-att] value[http://www.example2.com]
    What am I missing? How do I get the namespace declaration? Thanks for your help in advance.
    Cheers,
    Felix

    I'll try to explain in a better way ...
    I have a server with 2 different client and each client communicate to the server with a different interface.
    My needs are to recognize from the server, the type of the client that are operating, and to do this I was thinking to recognize the interface used from the client to interact with the server
    An other option is that, from the client, after retrieving the server and it's cast, a can call a method to pass to the server object, the type of the interface actually used.
    But I think this makes a bit of nonsense because When I receive the marshalled object in my opinion doesn't make sense that i have to say the object it's type (the interface used).
    the object is already alive and I think it has to know the interface used to refer it even if is on another VM
    The cast operation doesn't store nothing into the current object instance?
    local code example (I don't know if with JRMI the situation is different because the different JVM)
    Map foo = new HashTable();
    I need a method like
    foo.curretUsedInterface() ... that return "Map"
    instead of
    foo.getClass().getName() that return "HashMap"
    It's possible to obtain this information or I have to try another idea to make the server distinguish the client type?
    thank you very much for your comprehension

  • Unnecessary  Namespace declarations

    Hi,
    When mapping (graphic) to an externally defined XML schema where some elements belong to different namespaces I get namespace declarations on each element in the resulting XML instance even though they refer to the same ns name. The problem is that the XML document, even though valid, is very verbose. Is there a way to get all ns declarations in the root element instead without using XSLT?
    Example output
    <?xml version="1.0" encoding="utf-8" ?>
    <ns1:RootElement xmlns:ns1="http://foo.com">
    <ns2:Element1 xmlns:ns2="http://junk.com" />
    <ns2:Element2 xmlns:ns2="http://junk.com" />
    <ns2:Element3 xmlns:ns2="http://junk.com" />
    </ns1:RootElement>
    I would like to get something like this instead:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns1:RootElement xmlns:ns1="http://foo.com" xmlns:ns2="http://junk.com">
    <ns2:Element1 />
    <ns2:Element2 />
    <ns2:Element3 />
    </ns1:RootElement>
    Kind regards Johan

    Hi,
    I was probably not clear enough in my question.
    My Scenario is CRM -> Xi -> External system.
    The inbound interface to the external system is a predefined XML Schema where not all components/elements belong to the same namespace.
    When executing a mapping, created with the graphical mapping tool in Xi, the resulting XML document/Instance is valid but very verbose since XI put namespace declarations in every element over and over again instead of just putting them once in the root element.
    I don't think this has anything to do with the XSD, but rather with the mapping program.
    The result is that the receiving system takes a performance hit. I would like to find a way to force XI to just declare the same ns once in the root element instead of over and over again?
    kind regards Johan

  • Duplicate namespace declarations when writing a file with JCA file adapter

    I am using JCA File adapter to write a an XML file. The composite contains a mediator which received and transforms an XML to desired format and then calls a JCA file adapter to write the file.
    The problem that I am having is that the written file has declaration of namespaces repeated with repeating elements instead of a single declaration at root. For ex.
    instead of
    <ns0:Root xmlns:ns0="namespace0"  xmlns:ns1="namespace1" xmlns:ns2="namespace2">
    <ns0:RepeatingChild>
    <ns1:Element1>value1</ns1:Element1>
    <ns2:Element2>value2</ns2:Element2>
    </ns0:RepeatingChild>
    <ns0:RepeatingChild>
    <ns1:Element1>value3</ns1:Element1>
    <ns2:Element2>value4</ns2:Element2>
    </ns0:RepeatingChild>
    </ns0:Root>What I see in the file is:
    <ns0:Root xmlns:ns0="namespace0"  xmlns:ns1="namespace1" xmlns:ns2="namespace2">
    <ns0:RepeatingChild>
    <ns1:Element1 xmlns:ns1="namespace1" xmlns:"namespace1">value1</ns1:Element1>
    <ns2:Element2 xmlns:ns2="namespace2" xmlns:"namespace2">>value2</ns2:Element2>
    </ns0:RepeatingChild>
    <ns0:RepeatingChild>
    <ns1:Element1 xmlns:ns1="namespace1" xmlns:"namespace1">>value3</ns1:Element1>
    <ns2:Element2 xmlns:ns2="namespace2" xmlns:"namespace2">>value4</ns2:Element2>
    </ns0:RepeatingChild>
    </ns0:Root>So basically all the elements which are in different namespace than root element have a namespace declaration repeated even though the namespace identifier is declared at the root elment level.
    Although, the XML is still valid, but this is unnecessarily increasing the filesizes 3-4 times. Is there a way I can write the XML file without duplicate declarations of namespaces?
    I am using SOA Suite 11.1.1.4
    The file adapter has the schema set as above XML.
    I tried the transformation in mediator using XSL and also tried using assign [source(input to mediator) and target(output of mediator, input of file adapter) XMLs are exactly same].
    but no success.

    I used automapper of JDeveloper to generate the schema. The source and target schema are exactly same.
    I was trying to figure it out and I observed that if the namespaces in question are listed in exclude-result-prefixes list in xsl, then while testing the XSL in jDeveloper duplicate namespaces occur in the target and if I remove the namespace identifiers from the exclude-result-prefixes list then in jDeveloper testing the target correctly has only a single namespace declaration at the root node.
    But, when I deployed the same to server and tested there, again the same problem.

  • CFFEED & Namespace Declaration

    I would appreciate some help with generating rss feed for Google Merchant.  I am trying to use cffeed to generate the xml file which I am good with.  The issue is formatting it to google's specifications and their namespace declaration (<g:price></g:rpice>)  how to set a xml structure to include g:  in front of the names?
    Here is a sample of googe xml structure:
    <?xml version="1.0"?>
    <rss version="2.0"
    xmlns:g="http://base.google.com/ns/1.0">
    <channel>
    <title>The name of your data feed</title>
    <link>http://www.example.com</link>
    <description>A description of your content</description>
    <item>
    <title>Red wool sweater</title>
    <link> http://www.example.com/item1-info-page.html</link>
    <description>Comfortable and soft, this sweater will keep you warm on those cold winter nights.</description>
    <g:image_link>http://www.example.com/image1.jpg</g:image_link>
    <g:price>25</g:price>
    <g:condition>new</g:condition>
    <g:id>1a</g:id></item>
    </channel>
    </rss>

    I had a google around, and as far as I can tell it cannot be done with <cffeed> (*).  Just use <cfxml> instead, I reckon.
    And maybe raise an issue with Adobe: http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html.  If you do so, and post the bug ref back here, I'll vote for it too :-)
    Adam
    (*) http://www.coldfusionjedi.com/index.cfm/2008/4/23/Ask-a-Jedi-Handling-RSS-feeds-with-custo m-data.  Ray's pretty clued up about these things, so I'd take his word for it.

  • Inclusion of unused namespace declarations in marshalled XML

    Hello.
    I have noticed that by default any XML marshaled from an object contains namespace declarations related to every package specified when instantiating the JAXBContext even though they are not used in the instance being marshalled.
    Is there any way to avoid this during the marshalling as opposed to via some sort of post processing (e.g. XSLT transform).
    Example source below:
    package test;
    import javax.xml.bind.*;
    import java.io.*;
    import test.sample1.*;
    import test.sample2.*;
    public class Converter {
         public static void main(String[] args) {
              try {
                   String sample1 = "<Message1 xmlns=\"http://www.example.org/sample1\">" +
                                             "<tns:Field xmlns:tns=\"http://www.someother.org\">value</tns:Field>" +
                                        "</Message1>";
                   String sample2 = "<Message2 xmlns=\"http://www.example.org/sample2\">" +
                                            "<Field1>value1</Field1>" +
                                            "<Field2>value2</Field2>" +
                                        "</Message2>";
                   JAXBContext ctx = JAXBContext.newInstance("test.sample1:test.sample2");
                   Unmarshaller um = ctx.createUnmarshaller();
                   Marshaller m = ctx.createMarshaller();
                   StringWriter sw1 = new StringWriter();                
                   Message1 msg = (Message1)um.unmarshal(new StringReader(sample1));
                   m.marshal(msg, sw1);               
                   System.out.println("Marshalled sample1: \n"+sw1.toString());
                   StringWriter sw2 = new StringWriter();                
                   Message2 msg2 = (Message2)um.unmarshal(new StringReader(sample2));
                   m.marshal(msg2, sw2);               
                   System.out.println("Marshalled sample2: \n"+sw2.toString());
              } catch (JAXBException e) {
                   e.printStackTrace();
    }Produces output:-
    Marshalled sample1:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><Message1 xmlns:ns2="http://www.example.org/sample2" xmlns="http://www.example.org/sample1"><tns:Field xmlns:tns="http://www.someother.org">value</tns:Field></Message1>
    Marshalled sample2:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:Message2 xmlns:ns2="http://www.example.org/sample2" xmlns="http://www.example.org/sample1"><ns2:Field1>value1</ns2:Field1><ns2:Field2>value2</ns2:Field2></ns2:Message2>

    Thanks for the quick response. I really appreciate it.
    Yes, as you say, there is no real problem as such but part of my app lets the user see the RAW message XMLs and this could confuse them and would be tidier to remove but I can also see why it is easier from the Marshaller perspective not to have to back track to remove unused declarations.
    Also, I'm a little concerned about the increased size of the XML produced. One of my webservices does handle quite a few different types and our Oracle namespace URLs are all pretty long!
    Like I say, I can see a way to get rid of them after the fact but wondered if there was a more elegant/performant way.

  • Add dynamic namespace declaration into xml root element

    Hello all,
    i've have two scenarios (mail to mail and file to file) with the same issue : no namespace in my XML file and i have to create one 'dynamically' from XML values.
    Example :
    <root>
    <name>test</name>
    <email>test</email>
    <schema>schemaID</schema>
    </root>
    Now I want to add infos into the root element for namespace declaration and so on, without expansion of the xsd. I've must use the value from the field schemaID.
    Example:
    <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: namespace="http://test.de/schemaID">
    <name>test</name>
    <email>test</email>
    </root>
    I've already done it before through XSLT but it wasn't dynamic !! I don't know how to do it in XSL and i am not a java expert.
    Someone got an idea ?
    Thanks,
    Jean-Philippe.

    Hi,
      If you want to add name space at mapping level two options
    1)Using XSLT Mapping ,its very easy,google it to get sample XSLT code ,it will solve your problem.
    2)Using java mapping,in java mapping use regular expression code ,using regex(Regulkar expresion)we can add any content in message at any level.
    Regards,
    Raj

Maybe you are looking for

  • Does my mid 2010 macbook pro's displayport support audio (in addition to the video I know it supports)?

    I have been using my displayport to drive a video only HDMI input by way of a displayport to DVI converter followed by a DVI to HDMI converter. It works great but of course there's no audio at the end of that chain because DVI is a video only connect

  • Asset under constructions

    Dear Experts, I am new to this concept When i am settlement of AUC to main i asset i want create one cost element for external settlement. cost element catagery 22. My doubt is this cost element comes under expences or revenue. Regards venkataswamy

  • 24/7 chat always closed

    Over the last week I've repeatedly tried to get in contact with Adobe. Every time I try and ask a question on the 24/7 chat it says it's closed? I've also tried phone support numerous times and waited 20+ minutes and I'm yet to get through to anyone.

  • Customizing Oracle Financial Application

    We have upgraded from 10.7 to 11i. And I need to bring some old custom forms that were used in 10.7 to 11i. Please let me know how can I do that. And also I need to know what needs to be done to set up Forms developer 6i for Financial application cut

  • New MAC Pro up to 4 TB?? Why no more?

    Is there a limiting factor I am not aware of and why Apple only advertises a HDD capacity of up to 4 TB? I thought that with SATA drives of 1.5 TB and possibly more now, you would be able to get up to 6+TB or am I missing something? Thanks.