DataWriter - removing attributes from xml tag at the start of document

Hi,
I'm using DataWriter for generating a large XML document, however I do not want the attributees of the starting xml tag to appear in the final file.
Eg: <?xml version="1.0" {color:#ff0000}encoding="UTF-8" standalone="yes"{color}?>I do not want to output the part highlighted in red.
What could be the possible ways to do it? I prefer if it can be removed in the begining itself instead of parsing the document and removing in the end.
-TIA, saum
Edited by: nkrust on Feb 15, 2010 4:29 PM

try {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    Marshaller marshaller = new Marshaller(new OutputStreamWriter(
                              baos));
                    marshaller.marshal(ResponseContents);
                    // Create an object of type Document from the XML document
                    // created.
                    DocumentBuilderFactory domFactory = DocumentBuilderFactory
                              .newInstance();
                    domFactory.setNamespaceAware(false);
                    DocumentBuilder builder = domFactory.newDocumentBuilder();
                    responseDoc = builder.parse(new ByteArrayInputStream(
                              ResponseUtils.formatXMLString(baos.toString())));
               } catch (IOException e) {
                    e.printStackTrace();
                    System.out.println(e.getMessage());
               }

Similar Messages

  • How to remove xmlns attribute from XML tag?

    Hello!
    I have a XMLType document:
    --- P R O B L E M # 1 ---
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    I very need to remove from RESPONSE tag all addition information. Result I need is:
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE>
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    What can I do in this situation? My Oracle version is 9.2.
    --- P R O B L E M # 2 ---
    How I can create from source XML this one:
    <?xml version="1.0" encoding="windows-1257" ?>
    <MY_RESPONSE>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    </MY_RESPONSE>
    Thanks for your answers!
    Flu

    Maybe the problem#1 can be solved with a simple pl/sql using REPLACE statement. start with the <RESPONSE and look for the end > and get the entire string and replace that with only <RESPONSE> or maybe you can achieve this using xmldom to delete the attributes as part of the element.
    PRoblem#2 can be solved in this way.
    select xmlelement("MY_RESPONSE",
    xmltype('<RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>')).GetClobVal()
    from dual
    /

  • Remove XML tags in the File Adapter

    Hi,
    I have a JDBC to File interface. However, there is a requirement to remove some of the XML tags from XML produced by the File Adapter.
    For example,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_XML xmlns:ns0="namespace">
       <XMLIntegration>
             <Prices COLUMNS="Index, Date, Price">
             <Index>Fuel</Index>
             <Date>2007-05-01 00:00:00.0</Date>
             <Price>0</Price>
            </Prices>
          <Prices COLUMNS="Index, Date, Price"/>
      </XMLIntegration>
    </ns0:MT_XML>
    needs to be changed to
       <XMLIntegration>
             <Prices COLUMNS="Index, Date, Price">
             Fuel, 2007-05-01 00:00:00.0, 120.65
            </Prices>
      </XMLIntegration>
    Does anyone know how to do this? I'm using the File Content Conversion Message Protocol but I'm not having much success

    hi,
    you just need to have this:
    <XMLIntegration>
             <Prices COLUMNS="Index, Date, Price">
             Fuel, 2007-05-01 00:00:00.0, 120.65
            </Prices>
      </XMLIntegration>
    as your target message in your mapping
    and map all values to Prices tag
    you don't need no content conversion - just the mapping
    Regards,
    michal

  • How to remove elements/attributes from XML using Xpath in XSLT ??

    Hello ,
    Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
    Like I have such XML and I have to remove per attribute highlighted below
    <person per="and">
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    And want a result like this
    <person>
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    Thanks

    To achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
    your assign will look like:
    <bpel:assign>
    <bpelx:remove>
    <target variable="person" query="/person/@per" />
    </bpelx:remove>
    </bpel:assign>
    Regards,
    Melvin

  • Remove element from xml using dom.

    i want to remove an element from an xml file using dom.
    i remove the element but the whole content of the file is also deleted.
    how can i rewrite the file.

    vij_ay wrote:
    subject :Remove element from xml,but if empty element in input file then output should be <tag></tag>, not like <tag.xml/>I assume you mean <tag/> but why do you want this? Any application that will not accept this valid XML construct is flawed and a bug report should be raised against it.

  • How to remove Unicode from XML file

    I get following error when unmarshal xml:
    [java] org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    Anyone know how to remove Unicode from xml file? Can I remove the unicode by rebuild the file?
    Thanks

    These sort of error usually occur when you're using a different character encoding to read the file than the one you wrote it with. Perhaps if you were to post the problem section of the file and/or the code that created it in the first place.

  • Removing namespace from xml

    Hi,
    I have an xml which has some target namespace.
    I need to remove the namespace and the qualifiers and put it on a machine using a file adapter.
    Any help in this regard is highly appreciated.
    With Regards,
    Harsh

    Please go throught the below link
    Removing namespace from xml  created

  • Removing attributes from node

    Hi,
    Im creating a node and its attributes dynamically and binding it to a table to show a table dynamically. The problem is that when i load a new item, i have to rebuild the node and table because it might have different columns. The node allways has 3 fixed columns (id, name, description) so first i have to remove all of the attributes except the id, name and description. Same for the table columns. Can anyone tell me how to remove attributes from a node or how to differently solve my problem? All i see is how to remove an element but is a data right, not the model?
    Much thanks,
    Hugo Hendriks

    Hi,
    I had a similar situation, where 2 table columns were always present, and the name and type of other columns were only available runtime.
    I simply deleted all data (invalidate()) and recreated the context from scratch after each model execution that impacts the table structure.
    Otherwise, use the API to find the right methods for deleting Nodes and Elements.
    https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/index.html
    Good luck,
    Roelof

  • "Unterminated value for attribute '' in XML Tag ''.(SBL-UIF-00265)"

    Getting this message when I do Edit Web Layout for a view in Siebel tools 7.8.2 "Unterminated value for attribute '' in XML tag ''.(SBL-UIF-00265)"...Anyone have any idea why I am getting this message?

    Thanks Joseph,
    Actually I looked at the Refer ID 1280569.1 before also, some how I could not figured it out the exact location as I was searching for two "(double quotes).
    Today I tried again and finally I found out the culprit. In my case actually there was no two double quotes, instead the " (double quote) was missing.
    Thanks again.
    Edited by: user624054 on Oct 5, 2011 8:10 AM

  • How to pull the root level XML tags in the XML source-SSIS?

    Hi All,
    Can anyone please help out with the following requirement?
    There is a XML file data which I need to pull it to database. Please see the attached XML file.
    Question: When I am trying to pull the root level data (i.e. CreationDateTime and FileNumber) from XML source in the dataflow, the respective tag is not seen in the input. Can anyone help me how can I get those values in my input to pull the data to Database?
    Thanks & Regards,
    Sri

    Hi Sri,
    In SQL Server Integrated Services, we can generate XML Schema (XSD) file based on a XML file with XML Source Editor. For more details, please refer to the following steps:
    Double-click the XML Source in the Data Flow Task. 
    Browse the XML file for the XML location.
    Click the Generate XSD button to generate an XSD file.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • [JS] Find & Replace attribute in xml tags (InDesign CS4)

    Hi all,
    Can anyone help me please who i can find and change attribute in xml tags (InDesign CS4) files. I have both link tags but its other attribute different but one attribute same. So who i can change attribute preference.
    (1) one is
    (2) second is
    I want change link preference = 0 but only (2 number,  second) screen shoot. First screen shoot preference = 1 as it is.
    I want this but its manually
    Help me please. Thank you so much adv.
    Regard
    snegig

    Hi John Hawkinson,
    Thank you so much for replay. I am try Jeff, absqua code technique it is simply greet. But my problem is that my both tags link preference = 1 same and other link attribute almost same. So i am unable to change attribute.
    John my code below =>
    var doc = app.activeDocument,
    attNodes = doc.xmlElements[0].evaluateXPathExpression("//link[@preference = '1' or @role = 'generated']"), i, l;
    for (i = 0, l = attNodes.length; i < l; i++) {
    attNodes[i].xmlAttributes.item("preference").remove();
    John please update my code.
    Thank you so much adv.
    Regard
    snegig

  • I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?

    I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?
    Let me explain a little more. I had downloaded a lot of free books in the past as a trial when iBooks was first released and since then I have decided I no longer want them, because of this I hid them from the purchased section of the iBooks store. The 5 books left are ones I decided to keep as seen in the following picture.
    This is how it appears in iBooks on my mac. There are 4 books downloaded and 1 book that I have decided not to download at this time. I would still like to keep this book available in the cloud incase I want to download it again in the future. You’ll notice that hide iCloud books is not selected, if I wanted to hide the book that I have chosen to keep in the cloud, but have not downloaded yet I could.
    This is exactly how I think this feature should work. If you have hidden a book from your purchases it should not show up in the mac Ibooks app. (I am aware you can never actually delete a purchase, just hide them and that hidden purchases can be restored to your account from within the account management section of the iBooks store).
    The iOS app is working differently for me. Here is a picture of the purchased tab on the iBooks store in iOS Ibooks. Again notice that pictures of Lilly is still yet to be downloaded. This is how I expected it to look.
    If we visit the front page of iOS iBooks the view is very different from what I expected. Here we can see the 4 books I wanted to keep on my device and have downloaded. We can also see the 1 book I wanted to keep, but did not want to store locally on the device and left in iCloud (Pictures of Lilly). However we can also see all the books I had hidden from the purchased section of my iTunes account and which I believe should no-longer be visible, Dracula, frankenstein etc…
    I am aware of the hide iCloud books button within the iOS app, but I did not need to use this to hide the books I had removed from the my purchased section of the iBooks store on the mac, why are they still appearing in iOS?
    I’m still not sure if this is a software glitch or not. This article suggests to me that books can be hidden, but I had already completed these steps.
    https://support.apple.com/en-us/HT201322
    A browse of google also suggests people may have been able to hide past purchases from the front page of iBooks on iOS in the past.
    In case there was an issue with syncing I tried logging in and out of my iTunes account via settings in iOS. Force closing the app, disabling automatic downloads and removing my device from iTunes in the cloud. Syncing with iTunes on the mac did not correct the issue either.
    Interestingly I have the same issue on my iPhone 6 running iOS 8.3 as I do on my iPad mini suggesting that this might be an issue either with my account or with iOS iBooks software in general.
    If there is a way to remove the already hidden iBooks in your account from the front page of iBooks on iOS without using the hide iCloud downloads button? Please help community!

    My apologies for the lack of photos, here is my post again with photos.
    I have hidden unwanted books from the purchased area of the iBooks store, but they're are still appearing on the front page of iOS as cloud downloads, is there a way to remove these from iBooks without using the hide iCloud books button?
    Let me explain a little more. I had downloaded a lot of free books in the past as a trial when iBooks was first released and since then I have decided I no longer want them, because of this I hid them from the purchased section of the iBooks store. The 5 books left are ones I decided to keep as seen in the following picture.
    This is how it appears in iBooks on my mac. There are 4 books downloaded and 1 book that I have decided not to download at this time. I would still like to keep this book available in the cloud incase I want to download it again in the future. You’ll notice that hide iCloud books is not selected, if I wanted to hide the book that I have chosen to keep in the cloud, but have not downloaded yet I could.
    This is exactly how I think this feature should work. If you have hidden a book from your purchases it should not show up in the mac Ibooks app. (I am aware you can never actually delete a purchase, just hide them and that hidden purchases can be restored to your account from within the account management section of the iBooks store).
    The iOS app is working differently for me. Here is a picture of the purchased tab on the iBooks store in iOS Ibooks. Again notice that pictures of Lilly is still yet to be downloaded. This is how I expected it to look.
    If we visit the front page of iOS iBooks the view is very different from what I expected. Here we can see the 4 books I wanted to keep on my device and have downloaded. We can also see the 1 book I wanted to keep, but did not want to store locally on the device and left in iCloud (Pictures of Lilly). However we can also see all the books I had hidden from the purchased section of my iTunes account and which I believe should no-longer be visible, Dracula, frankenstein etc…
    I am aware of the hide iCloud books button within the iOS app, but I did not need to use this to hide the books I had removed from the my purchased section of the iBooks store on the mac, why are they still appearing in iOS?
    I’m still not sure if this is a software glitch or not. This article suggests to me that books can be hidden, but I had already completed these steps.
    https://support.apple.com/en-us/HT201322
    A browse of google also suggests people may have been able to hide past purchases from the front page of iBooks on iOS in the past.
    In case there was an issue with syncing I tried logging in and out of my iTunes account via settings in iOS. Force closing the app, disabling automatic downloads and removing my device from iTunes in the cloud. Syncing with iTunes on the mac did not correct the issue either.
    Interestingly I have the same issue on my iPhone 6 running iOS 8.3 as I do on my iPad mini suggesting that this might be an issue either with my account or with iOS iBooks software in general.
    If there is a way to remove the already hidden iBooks in your account from the front page of iBooks on iOS without using the hide iCloud downloads button? Please help community!
    iPhone 6, iOS 8.3, Also an issue on my iPad mini iOS 8

  • Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files?

    Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files? I just want to view / delete files without importing them.
    For instance I have 1200 photos on my iPhone Camera Roll. Some of these are shots, that I've taken multiple times, some good, some bad. I just want to clean up my Camera Roll, but going through the pictures on the iPhone's small screen is tedious. I'd much rather look at the camera roll's photo's on my Mac, and then decide which files I'd like to keep, and which to delete.
    I don't want to import the files, as when I import the files, and delete them from Camera Roll, now the Photo's are not on my phone, and the only way to get them back on my Phone is to Import them back in using iTunes, and then they go into the Picture Library and not the Camera Roll.
    In the same way as I can view Pics from my digital camera's SD card on a Mac without having to actually copy them to my computer, is there any app out there that will let me view my iPhone pics without importing them.

    gsharp01 wrote:
    Is there any way I can view / remove pictures from Camera Roll on the iPhone, on a Mac, without actually importing the files? I just want to view / delete files without importing them.
    The short answer is yes.
    Connect your iPhone to your computer.
    Open Image Capture application.
    Click on the 4 little squares at bottom to view them as photos, not a list.
    Select the photos them click the No Entry icon at bottom to delete.

  • PDF PO Release - XML Tags for the Header and Line Attachments

    Hi,
    I request you to please help me in finding out the XML tags for the PDF PO Release Header and Line Attachments? I tried to get the XML data by running the 'PO Output for Communication' program with the parameter as 'Debug' but its completing normally without giving me the XML data in the log file.
    Please help me in finding the XML tags for the PDF PO Release for the Header and Line Attachments.
    Thanks,
    Kunal

    Hi Kunal,
    Following syntax will get you the header and line level short and long text attachments.
    --Header short text attachments
    <?for-each:HEADER_SHORT_TEXT_ROW?>
         <?SHORT_TEXT?>
    <?end for-each?>
    --Header long text attachments
    <?for-each:/PO_DATA/HEADER_ATTACHMENTS/LONG_TEXT?>
         <?.?>
    <?end for-each?>
    --Line short text attachments
    <?for-each:LINE_SHORT_TEXT_ROW?>
         <?SHORT_TEXT?>
    <?end for-each?>
    --Line long text attachments
    <?variable@incontext:PoLnID;'PO_LINE_ID'?><?for-each:/PO_DATA/LINE_ATTACHMENTS/ID[. =$PoLnID]?>
         <?current()[$PoLnID]/preceding-sibling::TEXT[1]?>
    <?end for-each?>
    Also note that, while running the program in Debug mode for a particular PO/Release the status should be INCOMPLETE, otherwise you won't be able to see the XML tags.
    Thanks,
    PS.
    Edited by: PS on Sep 25, 2012 6:16 AM

  • Remove  Namespace from XML File except Attribute

    Hi  XI  Experts ,
    1.I have referred to the code of xslt Generic XSLT Code to Remove ALL Namespaces from XML:
    http://forums.sdn.sap.com/thread.jspa?threadID=1920630
    But this removes the Attribute : id  from the records .
    My expected output is supposed to be :
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record id="1">
           <fpdm></fpdm>
        </record>
    </data>
    </body
    But after using this XSLT code it removes :id from <record_1 id=> and generated the below code :
    The xml file now doesn't contain teh attribute :id
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record>
          1
          <fpdm></fpdm>          
           </record>
    </data>
    </body>
    Could  you please provide your input
    Plaese note : Here  XI versin iS x1 3.0 SP7 . I have tried suing the Analyzer bean for the Encoing  of Chinese : GBK Intsead of UTF-8 in the Namespace  . But AF_Modules/XMLAnonymizerBean is not comptacible with XI 3.0 SP7
    Hence i have used the following code to remove namespcae and add  Encoding :GBK instead of UTF-8:
    <?xml version="1.0" ?>
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output encoding="GBK"/>
    <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>

    You could use exclude-result-prefixes.
    For example:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wt="http://www.example.com" exclude-result-prefixes="wt">
    </xsl:stylesheet>

Maybe you are looking for

  • ORA-01722: invalid number error when trying to pass a list of values

    Gurus We are using a function like so The usage for the function below is Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual; SQL> / Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual ERROR at line 1: ORA-01722: invalid number It's givi

  • Help me choose a card plea

    Hi, I've recently bought a decent pair of headphones for my home computer and have started to hear a lot of noise / hiss on them when connected to the front connection of my case (especially noticable when nothing is playing). The noise increases a b

  • Convert String from UTF-8 to IsoLatin1

    Hi everyone ! I'm trying to convert a String from utf-8 to IsoLatin1, but i got somt problems.... I'm using actually this code, but it won't work... I'm getting a utf-8 html String with some data and i will write it down in latin1 to a text file Stri

  • Auth for creating PO : SAP R3, Oracle 9i, Sun Solaris

    Hi experts, I need to give authorizations as follows. 1. Auth for creating PO (ME21N) for 10 users of Document type (M_BEST_BSA =All) 2. Auth for creating PO (ME21N) for 20 users of Document type (M_BEST_BSA =UB) 3. Display of POs (ME23N) to all 30 u

  • AVHD files not being deleted by Hyper-V when DPM backs up virtual machines

    Hi, I understand DPM uses checkpoints to backup Hyper-V virtual machines. We have seen a few instances whereby the AVHD files that are created at the time DPM backs up the VM are not being deleted on the CSV disk. There are no checkpoints associated