Adding Namespace in Sender Payload

Hi Gurus,
I am stuck up with an issue.
My input file looks like this:
<ITEM>
    ABC
    DEF
</ITEM>
But, we need to create a structure like below in PI:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_DATA xmlns:ns0="http://xyz.com/MN/">
<ITEM>
          ABC
          DEF
</ITEM>
</ns0:MT_DATA>
I have tried removing the namespace from MT, and it is working fine.
But I need to implement Java Mapping for this requirement.
I have found blogs which tells me, how to add a namesapce. But then I do not know how to add the ending tag </ns0:MT_DATA>
Any help would be highly appreciated.
Thanks,
Swathi

Hi Swathi,
               Please find the code
          DocumentBuilderFactory dbFact = DocumentBuilderFactory.newInstance();
          DocumentBuilder dBuilder = dbFact.newDocumentBuilder();
          Document doc = dBuilder.parse(inputStream);
          Document targetDoc = dBuilder.newDocument();               //create target document
          Element targetRoot = targetDoc.createElement("ns0:MT_DATA");
          targetRoot.setAttribute("xmlns:ns0","http://xyz.com/MN" );     //set namespace
          targetDoc.appendChild(targetRoot);
          NodeList nList = doc.getElementsByTagName("ITEM");
          for(int i =0 ;i<nList.getLength(); i++){
               Element item = (Element)nList.item(i);
               String itemValue = item.getChildNodes().item(0).getNodeValue();
               Element targetItem = targetDoc.targetDoc.createElement("ITEM");
               targetItem.appendChild(targetDoc.createTextNode(itemValue));
               targetRoot.appendChild(targetItem);     
Regards
Priyanka

Similar Messages

  • Adding Namespace in Sender File Adapter Scenario.

    Hi All
    I have a scenario where  XI has to Pick Up XML a file and process it. The structure of the file is as follows
    <?xml version="1.0" encoding="UTF-8" ?>
    <Header>
         <Seg1>
         </Seg1>
    </Header>
    This file does not contain any any namespace tag. I guess XI would not be able to pick up this file if there is no namespace in the XML file . The file expected by XI would be something like this.
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:MessageTypeName xmlns:ns0="...namespace...">
    <Header>
         <Seg1>
         </Seg1>
    </Header>
    </ns0:MessageTypeName>
    Is there a way this can be handled at the File Sender adapter side . I am aware about  adding adapter module. Is there any other way to add the missing two namespace tags at the top and bottom of the file .
    any help would be appreciated.
    regards
    Nilesh .
    Edited by: Nilesh Taunk on Apr 7, 2008 2:11 PM

    Hi Nilesh,
    Yes it is possible in File sender adapter to give the namespace. In FCC you can give inside Document Specification.
    Under Document Name, enter the name of the XML document.
    The document name is inserted in the message as the main XML tag. This is mandatory for the mapping.
    Under Document Namespace, enter the namespace of the document.
    The namespace is added to the name of the document. This is mandatory for the mapping
    I hope this will help you.
    Regards
    Aashish Sinha

  • Namespace in XML Payload for HTTP Sender

    Hello,
    I have just configured my snychronous HTTP <--> RFC Scenario. When I want to test it with some XML payload in the HTTP testing tool I get a mapping runtime exception.
    After some investigation using the test tab in the message mapping I realized that missing namespace in the XML payload caused the error. I tried to add manually a namespace to the XML and then it worked
    This is very strange I though that the namespace of the sender interface is automatically added to the XML payload?
    Do you have any information on this?

    Hi,
    U need to copy the payload from Message mapping test message tab and use that payload.
    or u can use the HTTP test client for testing the same.
    sample HTML code to create HTTP Client:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/66dadc6e-0a01-0010-9ea9-bb6d8ca48cc8
    You can also use the Wfetch application by Microsift for the same..
    download the same from below link
    http://www.iisfaq.com/Default.aspx?tabid=2975
    Thnx
    Chirag

  • Sender SysId, Sender ObjectType or Sender payload is missing.

    Hello Experts,
    i'm currently trying to learn about B1i.
    I installed the current version of B1i (Version B1iSN2007.P11.3.46 ) and started with the B12B1 example, presented here.
    I managed to follow the instructions without too much problems, but I'm actually stuck at monitoring the results.
    When I submit a PO, i get the following error in the logs: Sender SysId, Sender ObjectType or Sender payload is missing.
    I checked the forums on this issue, but haven't found an answer. I actually followed the instructions in the blog very closely.
    I also seem not to have a Receiver Type 2007_SO, which is why i wrote the needed parts myself.
    If someone could help me continue, i would be really thankful!
    Sincerely,
    Florian

    Hi Florien,
    Last week I had the same error during a demo :o(
    I find out the problem after the demo but the demo was already registered with all the steps showing how to try to find a problem in B1iSN...
    In my case it was due to a double definition of the same B1 object in B1iSN.
    There is a limitation in B1iSN for B1 objects. You can only define 1 custom B1 object per each type of B1 object. So you can have only for example one custom definition of the B1 PO object apart from the B1iSN default definition for the PO.
    Hope it works also for you
    Regards
    Trinidad.

  • [svn:fx-trunk] 5587: Adding @namespace to halo and haloclassic defaults. css themes.

    Revision: 5587
    Author: [email protected]
    Date: 2009-03-26 12:06:28 -0700 (Thu, 26 Mar 2009)
    Log Message:
    Adding @namespace to halo and haloclassic defaults.css themes.
    QE: Could you please check if this fixes the recent themes issues, and that -compatibility-version=3.0.0 still works as expected too?
    Dev: No
    Doc: No
    Checkintests: Pass
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/halo/defaults.css
    flex/sdk/trunk/frameworks/projects/haloclassic/defaults.css

    I just saw that we are using xmlns:mx="http://www.adobe.com/2006/mxml" in all our custom components written in mxml, including our main application.
    In our custom css, I have the default namespace set to:
    @namespace "library://ns.adobe.com/flex/mx";
    could this result in these warnings ?

  • Adding namespace to the source file

    Hi,
    We are sending xml file data from MDM to XI.
    How can we add the interface namspace to the root node of the message?
    Any inputs on the same would be helpful because without adding the namespace the data is not getting picked from MDM.
    Regards,
    Sampada

    Hi!
    The examples that ship with the book have been developed for BPEL Process Manager 2.x. In version 10.x the XPath expressions have to include namespaces in the steps. For example, when checking the flight ticket price, instead of:
    <case condition="bpws:getVariableData('FlightResponseAA',
    'confirmationData','/confirmationData/Price')
    &lt;= bpws:getVariableData('FlightResponseDA',
    'confirmationData','/confirmationData/Price')">
    we have to write:
    <case condition="bpws:getVariableData('FlightResponseAA',
    'confirmationData','/confirmationData/aln:Price')
    &lt;= bpws:getVariableData('FlightResponseDA',
    'confirmationData','/confirmationData/aln:Price')">

  • Sender Namespace and Sender Interface in the IDOC to IDOC scenario

    My question maybe very basic...
    It is SAP IDOC to SAP IDOC scenario.
    Lets assume that I have done config in XI for:
                 Sender  = A,
                 Interface = B,
                 Namespace = C.
    My question is:
    Is there a place in the source system or somewhere to point that
    when an IDOC e.g. DEBMAS is triggered in the source system,
    then the Interface should be B and  Namespace should be C in the xml file ?
    Cheers
    Agnie

    Hi Agnieszka,
         Check these threads/blogs from you may get some help:
    /people/michal.krawczyk2/blog/2005/11/21/xi-idoc-to-idoc-tunneling--how-fast-and-easy-can-you-get
    Idoc-to-idoc scenario
    IDoc to IDoc scenario  necessary configuration steps
    For A-Z help on IDOC, you can refer Michal's book:
    <a href="/people/michal.krawczyk2/blog/2006/10/11/xi-new-book-mastering-idoc-business-scenarios-with-sap-xi IDoc Business Scenarios with SAP XI</a>
    Regards,
    Subhasha Ranjan

  • XSLT for adding Namespace is not being executed at runtime

    Hi Gurus,
    I am trying to add a Namespace to inbound xml and I wrote a simple XSLT mapping as below, when I execute this using XML spy or in Operation mapping manually it is working fine and giving me output as expected but at runtime it is not executing, I am getting same input xml as output xml and receiver agreement is failing...
    Appreciate your thoughts..
    <?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="*">
              <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
              <xsl:copy-of select="//SalesReportInfo"/>
         </ns0:SalesXmlExtended>
         </xsl:template>
    </xsl:stylesheet>
    input xml is as below....
    <?xml version="1.0" encoding="UTF-8"?>
    <SalesXmlExtended>
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum> etc...
    output I am getting in XMLSpy and OM is as below, this is exactly what I need...
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum>
    Thanks...
    Sukarna...

    Hi Baskar,
    Yeah, that is what my issue is , it shouldn't be failing but it is...
    I tried by manipulating the required namespace in the input file and it is working fine with out any errors....so I am guessing the XSLT is not being executed...
    I am getting below error which is valid because the transformation is not happening
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Technical Routing --> <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="OUTBINDING">CO_TXT_OUTBINDING_ERROR</SAP:Code>
    <SAP:P1>-BS_HOUSE_OF_FRASER_DEV</SAP:P1><SAP:P2>-BD1_100,urn:.com/HoF/POS/EOD/sndr.SI_Out_HoFSales_XML</SAP:P2>
    <SAP:P3/>
    <SAP:P4/>
    <SAP:AdditionalText>No standard agreement found for , BS_HOUSE_OF_FRASER_DEV, , BD1_100, urn:/HoF/POS/EOD/sndr, SI_Out_HoFSales_XML</SAP:AdditionalText
    ><SAP:Stack>Problem occurred in receiver agreement for sender -BS_HOUSE_OF_FRASER_DEV to receiver -

  • XSLT : Trouble Adding Namespace

    I need to add namespace xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06" to my xml document after doing a PI message mapping.
    When I run the following XSLT code in my XML editing software, it works as desired.  When I import the XSL program and use it at runtime, it is not adding the namespace.  Can anyone help?
    XSLT:
    <?xml version='1.0' encoding='utf-8'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="/*">
        <xsl:copy>
          <xsl:copy-of select="document('')/xsl:stylesheet/namespace::*[not(local-name() = 'xsl')]"/>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>
    Source:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:ChartOfAccountsReplicationConfimation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global">
      <MessageHeader>
        <UUID>4C321305CA1400AAE10080000A98800D</UUID>
        <ReferenceUUID>4bff533d-2452-00f2-e100-80000a98800c</ReferenceUUID>
        <CreationDateTime>2010-07-06T13:57:30Z</CreationDateTime>
        <SenderBusinessSystemID>ERP_GTPSRM_ECC6_S1</SenderBusinessSystemID>
        <RecipientBusinessSystemID>EDG_030_BusinessSystem</RecipientBusinessSystemID>
      </MessageHeader>
      <Log>
        <BusinessDocumentProcessingResultCode>3</BusinessDocumentProcessingResultCode>
        <MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
        <Item>
          <Note>Processed by PI</Note>
        </Item>
      </Log>
    </ns0:ChartOfAccountsReplicationConfimation>
    Desired Target:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:ChartOfAccountsReplicationConfimation xmlns:ns0="http://sap.com/xi/SAPGlobal20/Global" xmlns:prx="urn:sap.com:proxy:SB1:/1SAI/TAS04BED82951A661E02EC4:701:2008/06/06">
         <MessageHeader>
              <UUID>4C321305CA1400AAE10080000A98800D</UUID>
              <ReferenceUUID>4bff533d-2452-00f2-e100-80000a98800c</ReferenceUUID>
              <CreationDateTime>2010-07-06T13:57:30Z</CreationDateTime>
              <SenderBusinessSystemID>ERP_GTPSRM_ECC6_S1</SenderBusinessSystemID>
              <RecipientBusinessSystemID>EDG_030_BusinessSystem</RecipientBusinessSystemID>
         </MessageHeader>
         <Log>
              <BusinessDocumentProcessingResultCode>3</BusinessDocumentProcessingResultCode>
              <MaximumLogItemSeverityCode>1</MaximumLogItemSeverityCode>
              <Item>
                   <Note>Processed by PI</Note>
              </Item>
         </Log>
    </ns0:ChartOfAccountsReplicationConfimation>

    HI Stefen,
    I had one XSL question,i have seen in the blogs you have given correct answers regarding the XSLT.
    My requirement is  the source file is :
    <?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"/>
    <ns0:Esri_Identify
    xmlns:ns0="http://ottawa.ca/ecc/esri/ecctoesri">
       <Identify>
          <MapDescription>
             <Name/>
             <Rotation/>
          </MapDescription>
          <MapImageDisplay>
             <ImageHeight/>
             <ImageWidth/>
             <ImageDPI/>
          </MapImageDisplay>
          <SearchShape>
             <X/>
             <Y/>
          </SearchShape>
          <Tolerance/>
          <IdentifyOption/>
          <LayerIDs>
             <Int/>
          </LayerIDs>
       </Identify>
    </ns0:Esri_Identify>
    and expected is :
    <?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"/>
    <ns0:Esri_Identify
    xmlns:ns0="http://ottawa.ca/ecc/esri/ecctoesri">
       <Identify>
          <MapDescription>
             <Name/>
             <Rotation/>
          </MapDescription>
          <MapImageDisplay>
             <ImageHeight/>
             <ImageWidth/>
             <ImageDPI/>
          </MapImageDisplay>
         <SearchShape xmlns:q4="http://www.esri.com/schemas/ArcGIS/10.0" xsi:type="q4:PointN" xmlns="">
             <X/>
             <Y/>
          </SearchShape>
          <Tolerance/>
          <IdentifyOption/>
          <LayerIDs>
             <Int/>
          </LayerIDs>
       </Identify>
    </ns0:Esri_Identify>
    I need to pass the name space for searchshape element, can you please help me in this regard.
    Thanks,

  • Adding namespace qualification to elements...

    <!-- -- Begin data to be encrypted ----->
    <m:sayHello xmlns:m="http://www.bea.com/servers/wls/samples/examples/webservices/basic/javaclass3">
    <intVal xsi:type="xsd:int">3</intVal>
    <string xsi:type="xsd:string">ABCDEFG</string>
    </m:sayHello>
    <!----- End data to be encrypted -- -->
    Above is the data that I'm encrypting.
    I'd like to ***add*** xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" to BOTH the <intVal> and <string> elements. Is this possible?
    The other option would be to OMIT the xsi:type and make it less strict but as I understand the value of type MUST BE an "NMTOKEN" -- so presumably can't be anything loosey-goosey?
    =======================================================
    So I'd like the data I'm encrypting to look like this:
    =======================================================
    <m:sayHello xmlns:m="http://www.bea.com/servers/wls/samples/examples/webservices/basic/javaclass3">
    <intVal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:int">3</intVal>
    <string xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">ABCDEFG</string>
    </m:sayHello>
    =================================
    Here is my web-services.xml file:
    =================================
    <?xml version="1.0" encoding="UTF-8" ?>
    - <web-services>
    - <web-service useSOAP12="false" targetNamespace="http://www.bea.com/servers/wls/samples/examples/webservices/basic/javaclass3" name="HelloWorld" style="rpc" uri="/HelloWorld">
    - <security>
    - <user>
    <name>ivory</name>
    <password>itfloats</password>
    </user>
    - <encryptionKey>
    <name>s1as</name>
    <password>changeit</password>
    </encryptionKey>
    - <spec:SecuritySpec xmlns:spec="http://www.openuri.org/2002/11/wsse/spec" spec:Namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" spec:Id="default-spec">
    <spec:UsernameTokenSpec PasswordType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText" />
    <spec:BinarySecurityTokenSpec EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" />
    <spec:EncryptionSpec spec:EncryptBody="true" spec:EncryptionMethod="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" spec:KeyWrappingMethod="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
    </spec:SecuritySpec>
    <spec:SecuritySpec xmlns:spec="http://www.openuri.org/2002/11/wsse/spec" spec:Namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" spec:Id="nothingburger-spec" />
    </security>
    - <components>
    <java-class name="jcComp0" class-name="examples.webservices.basic.javaclass3.HelloWorld" />
    </components>
    - <operations>
    - <operation name="sayHello" method="sayHello(int,java.lang.String)" component="jcComp0" in-security-spec="default-spec" out-security-spec="nothingburger-spec">
    - <params>
    <param style="in" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:int" location="body" name="intVal" class-name="int" />
    <param style="in" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:string" location="body" name="string" class-name="java.lang.String" />
    <return-param xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="xsd:string" location="body" name="result" class-name="java.lang.String" />
    </params>
    </operation>
    </operations>
    </web-service>
    </web-services>

    Hi Stefan,
    I am partially able to add prefix to the XML.
    Here what I did for Module Configuration:
    1. Added Module  AF_Modules/XMLAnonymizerBean after std module in Soap Receiver Adapter
    2. Parameter Name: anonymizer.acceptNamespaces
        Parameter Value : http://xyz/mdm ns0
    Below is the reponse xml with namespace prefix only in the root tag,  no prefix for child tags.
    <?xml version='1.0' encoding='utf-8'?>
    <ns0:getUpdateListResp xmlns:ns0='http://xyz/mdm'>
    <item>46246</item>
    <item>46247</item>
    <item>46248</item>
    </ns0:getUpdateListResp>
    How do I get the namespace prefix to all the tags in the XML?
    Thanks,
    Laxman

  • Adding NameSpace as Attribute of Element

    Hi all,
    I have an element called Batch which has the attributes BatchID="" NoOfEntries="" and what I have to do is add another attribute but this attribute needs to be:
    xmlns="urn:x-commerceone:document:com:commerceone:CBL:CBL.sox$1.0"
    It doesnt seem to be adding this extra attribute, even if I add another simpler attribute such as Names="john" it wont add any more....
    Is there a limit to the number of attributes you can add to an element using the following code:
    elm.setAttribute("Name", "John");If there is no limit would I be able to add the above (xmlns) as an attribute as I know it has some strange characters in there?

    Hi thanks for the help but I am slightly confused on this matter now,
    Basically what I have is an element in an XML as in the following:
    <bat:Batch Name=xyz" Age="123"
    xmlns="urn:x-commerceone:document:com:commerceone:CBL:CBL.sox$1.0"
    xmlns:bat="urn:x-commerceone:document:btsox:Batch.sox$1.0"
    xmlns:sro="urn:x-commerceone:document:telcoapisox:ServiceRequestOrder.sox$1.0"
    xmlns:dsl="urn:x-commerceone:document:btsox:DSL.sox$1.0"> I guess all these are definitions of namespaces. I cannot set the element name to bat:Batch as I think the colon isnt allowed and hance the use of the NSpace. The NSpace are as above,
    I have located the element that I want to add the above definition to, this is the element elm.
    Then using elm.setAttribute("", ""); I am adding the Name and Age attributes, but am having probs adding the namespace stuff and hence using the colon bat:Batch too,
    Please could you explain a bit further on this, I am looking around in the forums but not getting anywhere fast. Basically I need to have the above attributes as my header in the XML,
    Thanks again,

  • Adding namespace as prefix to existing trasport object contents

    Hi there,
    I'm dealing with the following situation:
    I've written a program, so it's already finished. Now the Idea is, unfortunately this Idea came to my mind a little late, to generate and use a namespace for all the transport objects included in the transport package, since this program will be deployed on different customer systems and I want to avoid inconsistency regarding the Y- / Z-Objects.
    I've already reserved a namespace and added it via SE03 >> Administration: Display/Change Namespaces to my system.
    Now my question:
    Is there any function or possibility to set this new namespace as prefix for all already existing objects in my transport package, or has this to be done manually for every single object?
    Any help and/or ideas in this matter will be kindly appreciated.
    Best Regards,
    Marc

    Hi Matt,
    thanks for your reply. I guess you're right, too bad
    Best regards,
    Marc

  • Adding namespace server and replicating folder structure

    Not sure if this is the correct forum. @mod, please redirect if applicable.
    When adding a second or subsequent Namespace server to a DFS Root, how is the virtual folderstructure replicated when that server is added?
    The folder-targets are stored in AD under the System container. However, folders (to create a sensible hierarchy) are not stored in AD. Where do they come from when a new Namespace server is added ?
    Regards, Marcel

    To answer your first question go to the link below.
    Overview of DFS Replication:
    http://msdn.microsoft.com/en-us/library/cc771058.aspx
    As for your second question review the answer below.
    Stand-alone and domain-based DFS namespace servers store DFS-related information in the registry. All namespace servers also store a copy of the namespace structure on a local volume on the server in DFS root folders and link folders as follows.
    Does this answer your questions?
    Reference used:
    DFS Namespaces: Frequently Asked Questions
    http://technet.microsoft.com/en-us/library/ee404780(v=ws.10).aspx

  • Adding namespace qualified element nodes

    Is there a way to add namespace qualified element nodes to
    a document stored in a BDBXML container using the XmlModify class
    (BDBXML version 2.3.10, Linux)? Or, for that matter, any other
    handles?
    Particularly, is it possible to achieve this using the PHP
    extension?
    Let me give an example.
    When doing queries, you can set a namespace in the XmlQueryContext
    or in the XQuery expression itself:
    # prefix cannot be '' as of BDBXML 2.3.10
    $qc->setnamespace('a', 'http://as-guides.com/wev1');
    declare namespace a = "http://as-guides.com/wev1"; ...
    declare default element namespace "http://as-guides.com/wev1"; ...
    You can then refer to your namespace qualified elements as "a:Bla"
    etc. Or just as "Bla" if you make your namespace the default
    namespace.
    So far, so good.
    Now what if I want to add a namespace qualified element to
    my document? However I go about setting the namespace I always end
    up with either an apparently namespace qualified element which the
    namespace is not registered for or an element in the empty
    namespace.
    What I want is my element to adhere to the namespace
    "http://as-guides.com/wev1", which is set as the default
    element namespace in my document.
    Here is an example document.
    <Broadcast xmlns="http://as-guides.com/wev1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://as-guides.com/wev1 ds.xsd">
    <Start epoch="1186100400">2007-08-03T00:20:00Z</Start>
    <End epoch="1186100700">2007-08-03T00:25:00Z</End>
    <Content>
    <Title>Tagesschau</Title>
    <Genre>Nachrichten</Genre>
    </Content>
    </Broadcast>
    And here is my PHP code.
    $docname = '2007-08-02-1186100400-25758173-ard.xml_41368';
    $mgr = new xmlmanager;
    $cont = $mgr->opencontainer($argv[1]);
    $cont->addalias('tv');
    $qc = $mgr->createquerycontext();
    $qc->setnamespace('a', 'http://as-guides.com/wev1');
    $qexp = $mgr->prepare('/a:Broadcast', $qc);
    $mod = $mgr->createmodify();
    $mod->addappendstep($qexp, XmlModify_Element, 'a:now', time());
    $doc = $cont->getdocument($docname);
    $docval = new xmlvalue($doc);
    echo $docval->asString(), "\n";
    $uc = $mgr->createupdatecontext();
    $mod->execute($docval, $qc, $uc);
    Here is what gets added as last child node under "Broadcast":
    <a:now xmlns="">1189605065</a:now>
    So the namespace prefix I specified is added verbatim, without
    regard to the namespace settings in $qc (XmlQueryContext) - which
    do work fine for the query. No namespace declaration for "a"
    is added to the document. The resulting XML is invalid, as
    xmllint correctly points out.
    namespace error : Namespace prefix a on now is not defined
    So settings in XmlQueryContext do not seem to have any bearing on
    my update. XmlUpdateContext, on the other hand, does not have any
    methods defined for setting the namespace.
    Not setting the namespace in $qc (XmlQueryContext) and specifying
    it in the XQuery itself didn't work either. I left out the call to
    "setnamespace()" and changed the query to:
    declare default element namespace "http://as-guides.com/wev1";
    /Broadcast
    And I changed "a:now" to just "now". Here is what got added:
    <now xmlns="">1189607498</now>
    I didn't expect this second version to work, but I did expect the first
    one to work.
    What is the meaning of supplying XmlQueryContext to the execute()
    method?
    Is there a way to add namespace qualified elements to a document?
    If so, how can it be done?

    Thanks for your answer, George. I haven't quite understood how to make it do the trick, though.
    To change one document I did:
    dbxml> open tv.dbxml
    dbxml> setnamespace a http://as-guides.com/wev1
    Binding a -> http://as-guides.com/wev1
    dbxml> getdoc 2007-08-02-1186104300-25758380-sat1.xml_40564
    1 documents found
    dbxml> print
    <?xml version="1.0" encoding="UTF-8"?>
    <Broadcast xmlns="http://as-guides.com/wev1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://as-guides.com/wev1 ds.xsd">
    <Start epoch="1186104300">2007-08-03T01:25:00Z</Start>
    <End epoch="1186105800">2007-08-03T01:50:00Z</End>
    <VPS>03:25</VPS>
    <Content>
    <Title>Moin</Title>
    </Content>
    </Broadcast>
    dbxml> append doc(2007-08-02-1186104300-25758380-sat1.xml_40564)/a:Broadcast element "" "<a:now xmlns:a='http://as-guides.com/wev1'>NOW</a:now>"
    Appending into nodes: doc(2007-08-02-1186104300-25758380-sat1.xml_40564)/a:Broadcast an object of type: element with name: and content: <a:now xmlns:a='http://as-guides.com/wev1'>NOW</a:now>
    0 modifications made.
    No change made to my document. I used the doc() function instead of collection() as in the example you gave. Using collection() as in your example (verbatim) I get an error message:
    stdin:17: append failed, Error: XmlModify::execute: Cannot perform a modification on an XmlValue that isn't either Node or Document type
    This is in the FAQ, but I don't quite get it.
    http://www.oracle.com/technology/products/berkeley-db/faq/xml_faq.html#49
    Anyway, I can still perform modifications outside of the container and then replace the document. Or wait till 2.4.
    Thanks for your answer and the good work. Regards,
    Michael

  • Help adding namespace to SOAP evenlope

    Hello,
    I am new to the world of SOA and I am working to figure out how to add a namespace to the envelope that s send from our SOAP messages...
    currently we send ...
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" >
    and we are being asked to send an additional namespace on the end ....
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:abc="http://something.com>
    How can I accomplish this using Jdeveloper 11?
    Thank you for any help in this matter

    You can achive this by having a dummy 1-1 transformation, but there is a danger that the xslt processer might not be able to get any data from the source, in that case you need to edit the transformation source to remove the namespaces from the xPaths of sources.
    Regards,
    Ajay

Maybe you are looking for