How to add an element with a namespace prefix (Part 2)

Hi all,
I previously asked a question about adding an attribute with a namespace prefix to an element that already exists and that declares the namespace prefix here:
https://forums.oracle.com/thread/2610142
I received an answer that works, but now I am stumped again when I have to add an element where the element name has the namespace prefix.
For example, let's say I already have this element:
<A xmlns="namespace" xmlns:def="myns_namespace"/>
And I want to add this element:
<def:B/>
To produce this:
<A xmlns="namespace" xmlns:def="myns_namespace">
     <def:B/>
</A>
and NOT this:
<A xmlns="namespace" xmlns:def="myns_namespace">
     <def:B  xmlns:def="myns_namespace"/>
</A>
This does not work:
SELECT
xmlserialize(document
    appendChildXML(
     xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
    , '/A'
    , xmlelement("def:D")
    , 'xmlns="namespace" xmlns:def="myns_namespace"'
  indent)
FROM dual;
Because of this error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00234: namespace prefix "def" is not declared
Error at line 1
31011. 00000 -  "XML parsing failed"
*Cause:    XML parser returned an error while trying to parse the document.
*Action:   Check if the document to be parsed is valid.
Is there any way to do this without the child element having the duplicate namespace declaration?
My oracle version is:
Oracle Database 11g Release 11.1.0.7.0 - 64bit Production

Hi,
This one's tricky, so tricky that I think it's not possible using Oracle built-in XML DML functions.
Even XQuery Update cannot do it (for now) because, likewise, the prefix is always redeclared at child level.
The only thing I can think of is XSLT (or maybe DOM manipulation) :
SQL> select xmlserialize(document
  2           xmltransform(
  3             xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
  4           , xmltype(
  5  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  6     xmlns:def="myns_namespace"
  7     xmlns:ns0="namespace">
  8    <xsl:template match="ns0:A">
  9      <xsl:copy>
10        <xsl:element name="def:B"/>
11      </xsl:copy>
12    </xsl:template>
13  </xsl:stylesheet>')
14         )
15        indent
16      )
17  from dual;
XMLSERIALIZE(DOCUMENTXMLTRANSF
<A xmlns="namespace" xmlns:def="myns_namespace">
  <def:B/>
</A>

Similar Messages

  • How to add Excise item with out chapter id

    Dear all,
    How to add Excise item with out chapter id?
    Chapter id of purchae items will be known only after receiving Invoice/gate pass/delivery  chalan from supplier/vendor
    To send a purchase order we need to create that particular item in the master, but with out assigning chapter id system is  not allowing to save without chapter id.
    How to solve this?
    I am with SAP 8.8 and PL 10
    Thanks in advance
    regards,
    Kumar

    Hi Kumar,
    Refer the book of chapter ID or find out on internet you will get the chapter ID.
    Still if you not able to get  the chapter id then consult with excise advisory.
    But you can add Excise PO until you have the excise details in Item master.
    Regards,
    Datta Kharat

  • Had Photoshop Elements 12 on my other Mac that recently got smashed, new one has no CD drive. How do I install Elements with my product key? Purchasing an external CD drive is not an option at this time after forking over the 2500 for the new Mac...

    Had Photoshop Elements 12 on my other Mac that recently got smashed, new one has no CD drive. How do I install Elements with my product key? Purchasing an external CD drive is not an option at this time after forking over the 2500 for the new Mac...

    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5.6| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Need detailed procedure on how to add an item with Item Style Check Box in

    Need detailed procedure on how to add an item with Item Style Check Box in Framework.

    The view instance should be the same as the view instance (view object) specified for your region.
    If the View Attribute already that you need already exists in the View Object then you can use it.
    Otherwise you have to extend the View Object and add the new attribute to it.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to add document name and document namespace to xml mail sender msg

    Hi,
    I have set up a sender mail CC that accepts messages already in XML format. However, the messages are missing the document name and document namespace. I am trying to use MessageTransformBean to add these to the message payload. However the examples I've found so far all talk about converting plain text coming in. When I used convertionTpe -> SimplePlain2XML it messed up the original content with unnecessary xml tags.
    Can someone please tell me how to insert the document name and namespace into the payload without converting the original xml content? Thanks in advance.

    Dont think there is a way.
    As the source is a XML, why dont you create the MessageType with the same name and namespace as the XML file in the email.
    Regards,
    Bhavesh

  • How to map secondry elements with main if have same ids for both?

    I need to map secondry elements with its matching primary elements if they both have same id.
    How can this be achieved in xslt.
    If ids are not matching then not a single element of secondry sholud be shown.
    If ids matching, then other fields of secondry elements, should be mapped to similar fields of primary elements.
    Eg: Its like some program running and in between some add on programs started (may be trailor or advertisement).
    the add on program is not always shown (optional), and whenever shown it has its own data information etc etc.
    Please provide me some input, how to map and proceed.
    Not sure what this code is really doing.
    <xsl:template match="SECONDARY_EVENT_LIST">
              <xsl:variable name="secondaryElements" select="ancestor::SCHEDULE/SECONDARY_ELEMENT_LIST"/>
              <xsl:for-each select="SCHEDULE_ELEMENT_ID">
                   <xsl:variable name="id" select="."/>
                   <xsl:apply-templates select="$secondaryElements/SCHEDULE_ELEMENT[(@ID=$id)]"/>
              </xsl:for-each>
         </xsl:template>
    Is this having any relation with what my requirement is all about?

    Hi,
    You can use XPATH command to get the exact tag.
    You can access each tag with it location like “/Report_Name/Group_Tag/Element_ID”.
    I think this will remove the ambiguity of Tags with same ID.

  • How to add Table element in PDF form in Webdynpro

    Hello Everybody,
    I am developing one application in Webdynpro using PDF form in it. I wantable control in PDF form. I read somewhere that we can add table control in PDF form. But i didnt find how to add the same. So if anybody knows then please help me.
    Thanx in advance...
    Bhavik

    Hi All,
    Please follow these steps to create tables in adobe interactive forms.
    Lets us take this example. We want to display employee information. The following fields are the one that we are going to display:
    1. employeenumber
    2. First name
    3. last name.
    First insert a "interactive form UI element" in the view. Create a value node and bind it to the data source of the UI element.
    Create a subnode called "Employee".
    Create 3 value attributes to display the 3 values.
    Open the form designer. Insert a subform. change its type to "flow content"(default is position content) and in the next drop down, choose the value as type "table".
    insert one more subform into this subform. change its type to "flow content" and from the dropdown, choose the value as "table row" and in the tab "binding", click the checkbox "min" and have its value as 1.
    now drag the elements from the data hierarchy into the second subform.
    save the form in the designer.
    go to the view implementation and populate the nodes with the value. if this is within a loop, the content of the second subform is repeated giving the user a "table".
    I hope the steps are clear.
    Regards,
    Chander

  • XPath to select elements with specific namespace attribute?

    To select all elements with a specific attribute, i can use
    //*[attribute::val1='true']for elements that look like
    <Name val1="true">hello</Name>But how can i select them, if the attribute has a namespace:
    <Name myns:val1="true">hello</Name>?

    If JDOM is used to parse a node with XPath, node namespace should be added to the XPath.
    XPath xpath=XPath.newInstance("/@myns:val1='true');                
      xpath.addNamespace("myns", "http://www.w3.org/2001/XMLSchema-Instance");

  • VideoPlayer.aspx page--how to add an element on page that allows to "Link to a Document" rather than "Add New Document"

    Hi All,
    We have SharePoint 2013 and are setting up a Video Library. The Video Player page is great, but rather than adding documents to this page, and have them go into a folder called "Additional Content" we would like to add an element to the page that
    would allow us to link to documents already on SharePoint so if something gets updated, then we don't have to worry about uploading documents in both places. However, because this is a Document Set, if I add a web part to the page (Content Query in this case)
    and then filter documents to the content query--it applies the content query and its filter to every single video's video player page.
    Anyone know of a way around this?

    Hi,
    According to your description, you might want to enable users add the links to documents in SharePoint Libraries in the “videoplayerpage.aspx”.
    The available OOTB features won’t be capable of your requirement, a possible workaround is that we can use JavaScript with JavaScript Client Object Model to achieve it programmatically.
    With JavaScript, we will be able to generate the controls needed in the “videoplayerpage.aspx” to provide users the abilities to get a link to a file in a SharePoint Library and
    display all the selected links in the current page;
    With JavaScript Client Object Model, we can save/read/update the related links of different video files in an extra list based on the ID of a video file. Also, it will enable us
    to query all the documents in all libraries in the current site.
    More information about JavaScript Client Object Model:
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
    Common Programming Tasks in the JavaScript Object Model
    http://msdn.microsoft.com/en-us/library/office/hh185015(v=office.14).aspx
    About how to
    modify the HTML source of a page using JavaScript:
    http://www.w3schools.com/js/js_htmldom_html.asp
    http://njarb.com/2011/06/update-html-content-using-javascript/
    It won't be an easy job to make all these things working together, therefore, a fact you might want to take into consideration is that more time and effort would be required to
    make it works.
    Feel free to reply if there any question about my suggestion.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • How to add a Link with children in the SuiteLink bar?

    Hello,
    I have developed a code to add a new link in the SuiteLink bar using delegate control that works as expected. Now I want to include a new link
    but with children, I have tried many options in my code but with not luck.
    What I need in the SuiteLink bar is something like:
    My Services   Newsfeed  OneDrive  Sites
        Service 1
        Service 2
        Service 3
    Any idea on how to achieve this?
    Thanks,
    Daniel
    Daniel Villacis

    Hi,
    According to your post, my understanding is that you want to add sublink in the top navigation bar.
    There is an article about this issue, it contains the steps about how to create a link with sublink in the top navigation bar, you can have a look at it.
    http://www.helpmeonsharepoint.com/2012/03/custom-sharepoint-top-menu-and.html
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • How to add screen elements at run time on button click in Web Dynpro abap?

    Hello All,
    I have a requirement wherein the user wants to add the textbox dynamically at runtime on button click action. My questions is, Is it feasible to dynamically add screen elements at runtime? If yes, how?
    Please help.
    Thanks

    Hi Ajinkya,
    This is absolutely possible! Adding view elements at runtime is called "dynamic programming". There are a lot of good resources and tutorials on SCN if you do a search. To start you off, here is an excellent series by Thomas Szücs:
    Dynamic Programming in Web Dynpro ABAP - Introduction and Part I: Understanding UI Elements
    Dynamic Programming in Web Dynpro ABAP - Part II: Handling ViewElements
    Dynamic Programming in Web Dynpro ABAP - Part III: Aggregations and DDIC-Binding of ViewElements
    Another option that avoids dynamic programming is to create the view element at design time but bind its visible property to a context attribute of type WDUI_VISIBILITY. You could initially set its visibility to "none" until the user clicks the button, then you could change its visibility to "visible".
    Cheers,
    Amy

  • Adobe Reader - how to add page numbers with the free version?

    Hey guys,
    Imagine I've got a PDF file and I want to create a new one by selecting some pages out of it. I know this is simply possible by using the PDFcreator but I want to add page numbers. As far as I know this is not possible with the free version of Adobe unless I would add the page number on every single page by using a text box. I want to make different catalogs from the PDF so the page numbers are really necessary. Have you got any idea how to solve that issue? You know that's pretty much the only thing I need to add which means it's not worth buying the Pro version. Unfortunately I only got the PDF and I can't work on it e.g. with MS word before I export it. Do you know if there is a way to add page numbers with a free version? There might be an additional free software which allows that?
    Thanks for your support! 

    Thanks for your quick replies.
    I know how to add text page by page. But obviously it's hard to place the numbers on the very same position, is it?

  • How to add a button with Javascript to Library

    Hi
    I am using Captivate 5.5 to create a template.
    In the files which will be created using this template, we will be adding a button which executes a Javascript. Now, my question is, since this button will be used on multiple slides in the file, can I add this button (with the Javascript) to the library? Currently, we create it manually everytime.
    We don't have a programmer in our team, so we can't create widget. Is there an alternative way?
    Thanks for your help.
    Sreekanth

    Thanks for that reply.
    I now have a blank slide with the button (including the javascript) on it which solves the problem of importing it manually.
    However, when we use this template to import PowerPoint presentations, when we publish the file, the first slide (the one on which I have this button) will be blank and has to be manually deleted.
    Is there a way to eliminate this manual work? I tried hiding and using some actions. But it was not of any use.

  • How to add all element of array?

    1-D array has N number of element .i want to sum all the element ,and the result is a number.
    can you give me some example?
    thanks.

    Just use the "Add Array Elements"-function located in the Numeric palette.
    Message Edited by becktho on 02-21-2006 12:58 PM
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    AddArrayElements.PNG ‏14 KB

  • How to add custom columns with BO data from GP to UWL

    Hi
    We have CE 7.1 in our project UWL taskitems only have GP workflow tasks.
    In UWL we can see that by default there are standard columns but now we need to add custom columns with data from ours BO associated to process instance
    For that we need to develop one custom connector for UWL where we can retrieve the values from custom conenctor to UWL.
    Currently our NWDS 7.1 does not have plugins for UWL Connector can anybody tell me where can I download this plugins?
    thanks in advance!
    Regards
    Cristian

    Hi,
    plz refer the following link
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0ee5047-c7a0-2a10-70b7-9557e3e4d440
    Regards
    Manohar

Maybe you are looking for

  • Exporting a PDF file

    How do I make a PDF folder of multiple PDF documents in order to export it to an internet site with the goal of creating a printed booklet? I have new MacG5 desktop using Yosemite OS 10.10.1.

  • FlatFile Schema inserts new line unwantedly

    The FlatFile schema like below It generates the File but there are some new lines CR LF inserted some of the places. The file is really big, not sure why. There are other schemas with the same property that works fine

  • Import Music Video Clips from iTunes

    Doing some creative intro videos using iTunes 6.0.3 music videos. Want to import to iMovie 4.0.1. do some editing & then use it back in iTunes as a music video. But iMovie won't recognize it. Stuck. How do I do it???

  • ITunes will not load on ipad

    iTunes will not load on ipad

  • Netflix and Closed Captioning

    Is there a way to turn on Closed Captioning in Netflix when using the AppleTV? I have a PS3 that I use for Hulu Plus, but I use my AppleTV for Netflix. The PS3 has the option of turning on Closed Captioning, but I can't find any such option for the A