Removing Default Namespaces from XML

Hi All,
I am having a situation where I can't remove the default
namespace from XML mainly
because there is no namespace prefix.
I hope this code snipped makes better sense.
function test():void
document:XML =
<test xmlns:soap="
http://example.com" xmlns="
http://swanmokshi.com">
<item>peter</item>
<item>jenny</item>
<item>JK Angel</item>
<test>
// I can remove the soap namespace by doing the following
soap:Namespace = document.namespace("soap");
document.removeNamespace(soap).
Alert.show(document.toXMLString()); // should now display
the xml document without the soap namespace
Note that removing the soap namespace is easy because of the
first namespace is named "soap". How do
I removed the unnamed namespace, xmlns="
http://swanmokshi.com" ?
regards,
Arun

Same problem for me.
XPath expression failed to execute. Error while processing xpath expression, the expression is "ora:processXSLT("Transformation_2.xsl", bpws:getVariableData("PartyID", "Header"))", the reason is Character reference "&#24" is an invalid XML character.. Please verify the xpath query.
I am getting the date from Oracle Advanced Queue

Similar Messages

  • How to remove default comment from XML output

    Hi,
    I have a requirement to generate the XML report with XML output(Not PDF). Everything is working fine except I am getting one comment line "<!--Generated by Oracle Reports version 6.0.8.28.0--> which is not required and I want to remove this line. This report will be run through Oracle Apps 11i.
    Thanks.

    Hi,
    There is option to change the "Prolog Value" but nothing is there to remove the comment.
    Thanks

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

  • 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

  • How to remove default value from table definition?

    Hi,
    running 9.2
    Following problem :
    I need to remove default value from table.
    Example
    CREATE TABLE MY_TABLE(
    NAME VARCHAR2(50) DEFAULT 'NAME',
    AGE NUMBER DEFAULT 0
    Now even when I use MODIFY like
    ALTER TABLE MY_TABLE MODIFY (NAME VARCHAR2(10) );
    The default is still there:
    SELECT DATA_DEFAULT FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'MY_TABLE';
    Is there any way?
    Thanks

    Thanks,
    found the answer. It is not possible!!!!
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3001.htm
    Note:
    If a column has a default value, then you can use the DEFAULT clause to change the default to NULL, but you cannot remove the default value completely. That is, if a column has ever had a default value assigned to it, then the DATA_DEFAULT column of the USER_TAB_COLUMNS data dictionary view will always display either a default value or NULL

  • How to remove prefix namespace in Xml from XmlBean

    I am trying to generate XML from XML Bean but i am getting namespace prefix in all my xml elements.
    For example
    <abc:Cutomer xmlns:abc="http://www.xyz.com/pqr>
    <abc:Name>
    I don't have this namespace prefix in my XSD (imported in Weblogic workshop).
    Is there any way that I can remove this prefix from my xml elements?
    Also, I don't need xml namespace in my xml string.
    Is there any way that I can generate xml without having namespace?

    Hello ,
    I think this issue as been discussed earlier in this forum. Refer follwoing link..
    http://forums.bea.com/bea/message.jspa?messageID=400000090#400000090
    Regards,
    Kuldeep Singh.

  • How to remove namespace from xml in ALSB?

    I have a xquery transformation which works for data without namespace. But the data coming from source system has namespace details in it. Is there a way to strip the xml of namespace details from xml before passing it to xquery transformation?

    Hi
    silly mistake :P
    Following 'bold' declaration was not there!!
    Just copy paste following code as xquery and it will be all ok:
    declare namespace xf = "http://tempuri.org/vijfhuizen/com/myMessage/";
    declare function xf:strip-namespace($e as element())
    as element()
    element { xs:QName(local-name($e)) }
    for $child in $e/(@*,node())
    return
    if ($child instance of element())
    then xf:strip-namespace($child)
    else $child
    declare variable $e as element() external;
    xf:strip-namespace($e)

  • How to remove an Element from XML by confirming Attribute of that element

    Hi guys
    I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
    here is my XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <users>
    <user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
    </users>for example i want to delete a user which have user id= Guest.
    How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
    Waiting for your replay.
    Thanks in Advance
    Best regard

    Hi,
    Till now i tried the following code which give null pointer exception at following line
    element.getParentNode().removeChild(element);
         public String removeUserByID(String id) throws Exception{
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                 DocumentBuilder builder = factory.newDocumentBuilder();
                 TransformerFactory tFactory = TransformerFactory.newInstance();
                 Transformer tFormer = tFactory.newTransformer();
                   doc = builder.parse(usersXml);
                 Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
    //             Remove the node
                 element.getParentNode().removeChild(element);
    //             Normalize the DOM tree to combine all adjacent nodes
                 doc.normalize();
                 FileOutputStream fos = new FileOutputStream(this.usersXml);
                   XMLOutputter out = new XMLOutputter();
                   out.output(((org.jdom.Document)doc), fos);
              /*     Source source = new DOMSource(doc);
                 Result dest = new StreamResult(System.out);
                 tFormer.transform(source, dest);
                 System.out.println();
                 return "true";
              if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
    Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
    Best regards and thanks again 4 ur reply.

  • How to remove empty lines from xml files after removing nodes from document

    <pre>
    Hi
    <b>i have xml document, which is shown below
    after removing some nodes from the document ,i am getting empty lines in place of removed nodes,how to resolve this and get the proper xml document without any errors</b>
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!DOCTYPE Message SYSTEM "TRD01.dtd">
    <Message>
    <Header>
    <CounterPartyType>CLIENT</CounterPartyType>
    <CreationTime>20134455</CreationTime>
    <ErrorCode>363 </ErrorCode>
    <ErrorEnterPriseId>N</ErrorEnterPriseId>
    <ErrorStatus>1</ErrorStatus>
    <ErrorSystemId>STL</ErrorSystemId>
    <ErrorTimes>31</ErrorTimes>
    <MessageType>T</MessageType>
    <RecipientEnterpriseId>N</RecipientEnterpriseId>
    <RecipentSystemId>EXM</RecipentSystemId>
    <Remarks>REMARSK</Remarks>
    <SenderEnterpriseId>N</SenderEnterpriseId>
    <SenderSystemId>TR</SenderSystemId>
    </Header>
    </Message>
    <ErrorCode>363 </ErrorCode>
    <ErrorEnterPriseId>NIHK</ErrorEnterPriseId>
    <ErrorStatus>1</ErrorStatus>
    <ErrorSystemId>STL</ErrorSystemId>
    <ErrorTimes>31</ErrorTimes>
    XPathExpression expression5 = xpath.compile(xmlpath5);
    Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
    Node node5 = (Node) result5;
    node5.getParentNode().removeChild(node5);
    XPathExpression expression6 = xpath.compile(xmlpath6);
    Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
    Node node6=(Node) result6;
    node6.getParentNode().removeChild(node6);
    XPathExpression expression7 = xpath.compile(xmlpath7);
    Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
    Node node7=(Node) result7;
    node7.getParentNode().removeChild(node7);
    doc.normalize();
    doc.normalizeDocument();
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    t.setOutputProperty(OutputKeys.INDENT, "yes");
    t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    t.setOutputProperty(OutputKeys.METHOD,"xml");
    t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    the xml output i am getting is
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <Message>
    <Header>
    <CounterPartyType>CLIENT</CounterPartyType>
    <CreationTime>20134455</CreationTime>
    <MessageType>TRD01</MessageType>
    <RecipientEnterpriseId>N</RecipientEnterpriseId>
    <RecipentSystemId>STL</RecipentSystemId>
    <Remarks>REMARSK</Remarks>
    <SenderEnterpriseId>N</SenderEnterpriseId>
    <SenderSystemId>T</SenderSystemId>
    </Header>
    </Message>
    <b>could you please let me know how to avoid empty lines in the xml doucment output</b>
    this is the method i am using to get the result
    public void ValidateRecord(String xml){
    try{
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = factory.newDocumentBuilder();
    //parse file into DOM
    /*DOMParser parser = new DOMParser();
    parser.setErrorStream(System.err);
    parser.setValidationMode(DTD_validation);
    parser.showWarnings(true);*/
    System.out.println ("HI THIS xml is validation "+xml);
    Resolver res = new Resolver();
    db.setEntityResolver(res);
    Document doc = db.parse(new InputSource(new StringReader(xml)));
    XPathFactory xpf = XPathFactory.newInstance();
    XPath xpath = xpf.newXPath();
    // XPathExpression expression = xpath.compile("//A/B[C/E/text()=13]");
    String xmlpath="/Message/Header/CounterPartyType/text()";
    String xmlpath1="/Message/Header/RecipentSystemId/text()";
    String xmlpath2="/Message/Header/ErrorSystemId/text()";
    XPathExpression expression = xpath.compile(xmlpath);
    XPathExpression expression1 = xpath.compile(xmlpath2);
    Object result = expression.evaluate(doc, XPathConstants.NODE);
    Object result1 = expression1.evaluate(doc, XPathConstants.NODE);
    Node node = (Node) result;
    Node node1 = (Node) result1;
    System.out.println("the values of the string is " +node.getNodeValue());
    System.out.println("the values of the string is " +node1.getNodeValue());
    // for (int i = 0; i < nodes.getLength(); i++) {
    //System.out.println(nodes.item(i).getNodeValue());
    // CAHNGING THE RECEIPENT NODE
    XPathExpression expression2 = xpath.compile(xmlpath1);
    Object result2 = expression2.evaluate(doc, XPathConstants.NODE);
    Node node2 = (Node) result2;
    System.out.println(node2);
    node2.setNodeValue(node1.getNodeValue());
    System.out.println(node2);
    //removing the nodes from document
    String xmlpath3="/Message/Header/ErrorCode";
    String xmlpath4="/Message/Header/ErrorEnterPriseId";
    String xmlpath5="/Message/Header/ErrorStatus";
    String xmlpath6="/Message/Header/ErrorSystemId";
    String xmlpath7="/Message/Header/ErrorTimes";
    XPathExpression expression3 = xpath.compile(xmlpath3);
    Object result3 = expression3.evaluate(doc, XPathConstants.NODE);
    Node node3 = (Node) result3;
    node3.getParentNode().removeChild(node3);
    XPathExpression expression4 = xpath.compile(xmlpath4);
    Object result4 = expression4.evaluate(doc, XPathConstants.NODE);
    Node node4 = (Node) result4;
    System.out.println("node value");
    System.out.println(node4.getParentNode().getNodeName());
    node4.getParentNode().removeChild(node4);
    XPathExpression expression5 = xpath.compile(xmlpath5);
    Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
    Node node5 = (Node) result5;
    node5.getParentNode().removeChild(node5);
    XPathExpression expression6 = xpath.compile(xmlpath6);
    Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
    Node node6=(Node) result6;
    node6.getParentNode().removeChild(node6);
    XPathExpression expression7 = xpath.compile(xmlpath7);
    Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
    Node node7=(Node) result7;
    node7.getParentNode().removeChild(node7);
    // Node b13Node = (Node) expression.evaluate(doc, XPathConstants.NODE);
    //b13Node.getParentNode().removeChild(b13Node);
    doc.normalize();
    doc.normalizeDocument();
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer t = tf.newTransformer();
    t.setOutputProperty(OutputKeys.INDENT, "yes");
    t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
    t.setOutputProperty(OutputKeys.METHOD,"xml");
    t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    t.transform(new DOMSource(doc), new StreamResult(System.out));
    catch (Exception e) {
         e.printStackTrace();
    System.out.println(e.getMessage());
    </pre>
    Edited by: user12185243 on Apr 6, 2013 6:38 AM
    Edited by: user12185243 on Apr 6, 2013 6:41 AM
    Edited by: user12185243 on Apr 6, 2013 6:43 AM
    Edited by: user12185243 on Apr 6, 2013 6:45 AM
    Edited by: user12185243 on Apr 6, 2013 9:00 AM

    either this way we can do this
    1)
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    <b> factory.setIgnoringElementContentWhitespace(true); </b>
    DocumentBuilder db = factory.newDocumentBuilder();
    or
    2)
    java.io.StringWriter sw = new java.io.StringWriter();
    StreamResult sr = new StreamResult(sw);
    t.transform(new DOMSource(doc), sr);
    String xml1 = sw.toString().trim();
    <b> xml1=xml1.replaceAll("\\s",""); </b>
    System.out.println(xml1.trim());

  • 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

  • Can't remove default repository from EM

    Hi
    Please can someone give an idea on how to permanently delete the default repository from oracle enterprise manager winfow. I am on windows xp with OBIEE 11g.
    I tried commenting out the NQSConfig from Star, but it keeps getting re-created
    Reggards
    Ify

    If you are referring to EM 12c and how to remove the em repository from the databases that houses it then follow the below notes:
    Note 1395423.1: 12c Cloud Control Repository: How to Manually Drop Repository Database Objects in 12c Cloud Control.
    Note 1365820.1: 12c Cloud Control Repository: RepManager Dropall Command Fails To Drop all the Repository Objects

  • Assign default namespace to XML fragment using XQuery

    Hi everybody!
    I need to add a default namespace declaration to a XML fragment using XQuery. I wrote following statement to assign fragment to $body:
    <soap-env:Body>{
    fn-bea:inlinedXML($content/text())}
    </soap-env:Body>
    The problem is "$content/text()" has no namespace declaration so I need to assign a default namespace (xmlns="") to it in order to apply some XQuery transformations to its content.
    I know this can be easily done with a XSLT but I would like use XQuery instead.
    Could anyone tell me how I could perform this task?
    Thank you in advance,
    Daniel.

    Re: xquery function - send namespace as binding variable and define it in a tag

  • Remove default value from dropdown list

    I am currently working with Acrobat XI Pro version. I want to know whether it is possible to remove the default value from a dropdown list.
    When the list has less than 4 items, it is possible to deselect the default value by pressing the whitespace below. However, when there are more items, this is not possible anymore.
    I have read that you should include a whitespace as item in the item list, however, then you will see an empty list item when people are working with the pdf which is not preferable.
    So, does anyone know how to remove the default value from a dropdown list?
    Thanks!

    Ok, I found a perfect workaround for my problem using FormsCentral for Acrobat. Here is what you should do:
    Step 1:
    -   Open FormsCentral
    -   Create New Form (Choose Blank Form)
    -   Click on the dropdown icon to create a new dropdown
    -   Fill in the list items by clicking on the edit (you also can add a label if you want)
    -   Click: File > Save as PDF Form...
    Step 2:
    -   Open the saved PDF (you now see a blank pdf with a dropdown menu)
    -   Click: Tools > Forms > Edit Form (when a popup shows that you should save a copy of the document in order to make changes, press "Save as a copy" and open the pdf copy file with Acrobat)
    -   Select the dropdown, copy the dropdown and paste it in the desired document
    Now you have a dropdown menu without a default choice. Keep in mind that you cannot edit the items in the dropdown, because a default choice will be chosen and you have to use the pdf copy file again. As long as you don't click on a list item, it doesn't choose a default choice.
    It is not a perfect solution, but it works for me.
    Good luck and thanks!

  • Remove default entry from drop down

    How can i remove the default entry from a dropdown element?
    Florin

    Hi Florin,
    If you are using DropDownByKey, just setting the current selection to some key value will remove the default blank entry.
    wdContext.current<node name>Element().set<attribute>(<key value of the selected data>);
    This will set the value corresponding to this key as the currently selected one in the dropdown and along with this, the default entry will also disappear
    Hope this helps,
    Best Regards,
    Nibu.

  • Removing Incorrect data from .xml files

    How do I remove info in the .xml files.
    When I 1st got my kit it read my fastest km as 4.55mins/km
    This is way too fast as my average is 6.00mins/km.
    Because the info is incorrect I am not getting congratulated by Paula or being able to improve slowly as I will never get to 4.55.
    HELP

    Haplogroup k,
    I think you have understood me. The file was created
    when the unit wasn't callibrated and recorded a false
    reading which was way too fast for me and a lot of
    runners also.
    I want to post best results now that the machine
    works right.
    Most people have said that they were amazed by how accurate the Nike+ was right from the box without calibration. But I'll take your word for it.
    I can get to the .xml files but it won't delete
    records, that's all I want to do.
    I don't know what you mean by "it won't delete records." Are you talking about your Personal Bests? No you cannot edit that fle. But you can delete a run from your Nano.
    However, you can save all your run data to your computer hard-drive, then RESTORE your Nano. But that will also wipe your calibration data and everything else (personal bests). I guess you could then recalibrate before doing any runs. Then put your old run data (your old xml files) back in your "latest" folder.

Maybe you are looking for

  • Sql is too long for DBMS_SQL.EXECUTE()

    The code as the following works. However if I run it with my original SQL statement(in quotes), this procedure does not have results shown. How to solve the problem? create or replace procedure dynamic_sql(p_fail IN tab.DisFai1_1%type) IS v_counter N

  • Video not automatically downloading in Photo Dowloader

    With my past Canon cameras, including the Canon 880IS, the videos taken with the camera would automatically download with the Photo Downloader of Photoshop Elements 6.0 without any special settings.  My new cameras, Canon D10 and Canon 7D, the videos

  • My ipad wont turn on

    I have an ipad 4 and now its not working.Last night when I went to sleep I left my ipad with a 25% battery life and when i woke up this morning I checked it and it had a black screen for few seconds then suddenly shut down. I figured it was just in r

  • PO Print Output Message Automatically Without Maintaing Condition Record

    Hi Team, User have the Requirement When Any New Vendor Create in SAP System Automatically Printout When they Create PO Without Maintaining Condition Record throgh T-Code MN04.It Possible throgh Config Side or Need to Take help of ABAP Team. Please he

  • Error during RAC installation

    Dear all, I am having a big issue when installing oracle RAC on windows 2003 service pack 1. during oracle cluster configuration assistants step an error takes place and the installation terminate the following is the complete log file data. Using pa