Remove XML declaration header in Oracle

Hi,
is there a way to remove the XML declaration <?xml version="1.0" ?> generated by oracle - ex
- <Envelope>
- <Body>
<?xml version="1.0" ?>
- <MSG09>
to
- <Envelope>
- <Body>
- <MSG09>
Thanks

Hi,
is there a way to remove the XML declaration <?xml version="1.0" ?> generated by oracle - ex
- <Envelope>
- <Body>
<?xml version="1.0" ?>
- <MSG09>
to
- <Envelope>
- <Body>
- <MSG09>
Thanks

Similar Messages

  • Remove xml declarations when using xslt

    Hi, i have created an xslt which transforms an xml file and then imports the information into a mysql database. It works and imports the information into the database but it also brings across the xml delcarations and the node names.
    Is there a coldfusion way to remove these declarations, all i want is the information itself brought into the database.
    Thanks
    Chris

    Hi Adam,
    here is the code from the xsl file:
    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="data/itemfeed.xml" --><!DOCTYPE xsl:stylesheet  [
        <!ENTITY nbsp  "&#160;">
        <!ENTITY copy  "&#169;">
        <!ENTITY reg    "&#174;">
        <!ENTITY trade  "&#8482;">
        <!ENTITY mdash  "&#8212;">
        <!ENTITY ldquo  "&#8220;">
        <!ENTITY rdquo  "&#8221;">
        <!ENTITY pound  "&#163;">
        <!ENTITY yen    "&#165;">
        <!ENTITY euro  "&#8364;">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
    <xsl:for-each select="Items/Item[ItemType='Standard']">
    <xsl:value-of select="EANNumber"/>
    </xsl:for-each>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    And here is some sample data from the XML file:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Items>
        <Item>
            <ItemType>Standard</ItemType>
            <EANNumber>111222333444</EANNumber>
        </Item>
    </Items>
    Thanks alot, i appreciate the help.
    Chris

  • Is it possible to remove xml declaration from a target HTTP msg in PI 7.1?

    Hello,
    I am working on a SOAP to HTTP scenario in PI 7.1.
    I am using a java mapping to create a target string. This target string does not contain XML declaration(<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>) in it.
    To elaborate the issue, while testing the message mapping, this XML declaration is not being prefixed to the message content. But, in integration engine, the http target message is being prefixed by this XML declaration by default.
    Output when tested in Operation Mapping(Desired result):
    abc=123:def=456
    Output been sent to receiver:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> abc=123:def=456
    Is there any possibility to send a  HTTP message to the receiver without this XML declartion. In other words, I need only the message content to be sent to the receiver.
    Kindly suggest.
    Regards,
    Swetha

    Hi,
    You can use JAVA/or XSLT mapping
    See this for Code
    Remove Encoding UTF from xml declaration in PI

  • Remove XML Declaration

    Hi,
    I am transforming some XML using Transformer class. I get the following output:
    XML Document transformed to:
    <?xml version="1.0" encoding="UTF-8"?>
    <VOTBEndpoint schemaVersion="1.00"><a n="id" v="jobmanager.fork" /><a n="Username" v="UserX" /><a n="spool.directory" v="/tmp" /></VOTBEndpoint>I don't want the first tag the, <?xml?>, does it have to stay in this document as I want very lightweight output, every byte counts.
    I thought the statements:
    Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltView));
                 transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes")
    // Run the transformation
    JDOMSource source = new JDOMSource(doc);
    JDOMResult result = new JDOMResult();
    transformer.transform(source, result);
    //Return transformed document
    return result.getDocument();I thought this code would have produced the output I wanted. If the XML tag must stay do you know how I can remove the carriage return the docuement places after this statement as I later convert the JDOM document to a string using XMLOutputter - it is really this stary \n that is cauing major issues - I could live with th e<xml> tag.
    Cheers -

    Hi Thanks for your response,
    Sorry I couldn't reply earlier I now have:
    Transformer transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltView));
    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
    transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");With both these declarations is still get the following output:
    <?xml version="1.0" encoding="UTF-8"?>
    <VOTBEndpoint schemaVersion="1.00"><a n="id" v="jobmanager.fork" /><a n="Username" v="UserX" /><a n="spool.directory" v="/tmp" /></VOTBEndpoint>I'll explain why this is annoying - this XML gets turned into a string using XMLOutputter then transported over the network using a messaging system (capable of transporting string values). Once this message gets to it's destination it needs to be reconverted to XML.
    This <XML> tag the transformer inserts has carriage returns after it which is casuing a problem so I figure I have two options:
    * Stop the <XML> tag from being outputted and then reconvert with SAX Builder
    * Once XML converted to a String remove the carriage returns manually using String.replace (NOTE: tried this method and transports fine but wont reconvert to XML using SAXBuilder. Exception occurs with message XML Construction Failed)
    If you can help with either - stop XML tag appearing or explain why the SAX Builder at the destination cannot convert back to XML i'd be most grateful!
    XML SAX cannot convert below (after option 1: manually removed carriage returns, all one line):
    <?xml version="1.0" encoding="UTF-8"?>
    <VOTBEndpoint schemaVersion="1.00"><a n="id" v="jobmanager.fork" /><a n="Username" v="UserX" /><a n="spool.directory" v="/tmp" /></VOTBEndpoint>And here is the code I'm using to convert:
    public String getMessageXMLAttributeValue(String attributeName) throws Exception{
              SAXBuilder builder = new SAXBuilder();
              XMLOutputter out = new XMLOutputter();
             try {
                  Document doc = builder.build(getMessageXMLPayload()); //here is where error is occurring!! method returns string value to build
                  out.outputString(doc);//debug
                  String val = (String) XPath.selectSingleNode(doc, "//a[@n='id']/@v");//this would be the attributreName field but just testing
              System.out.println(attributeName + " Attribute xpath'd as " + val);
                  return val;
              } catch (JDOMException ex) {
                   ex.printStackTrace();
                   return null;
              } catch (Exception ex){
                   ex.printStackTrace();
                   throw new Exception("Unspecfied Exception occurred: getSchemaAttribute " + attributeName);
         }

  • Oracle Service Bus 11g omit-xml-declaration="yes" not working in XSL-T

    I have the requirement of removing the XML header from xsl output.
    eg: <?xml version="1.0" encoding="UTF-8" ?> this part has to removed
    I tried using the following in XSLT:
    <xsl:output indent="yes" omit-xml-declaration="yes" />.
    It seems to work in all online xml compilers. It does not work in work in OSB.
    I posted the message in a JMS Queue and it contains the xml header.
    Is this a work around for this issue?

    I'm pretty sure XSLT has nothing to do with that PI.
    After all, XSLT in OSB doesn't format text, it generates an XmlObject. The formatting (including adding the <?xml?> PI) are done by other parts of the engine. Probably the XmlBeans serializator.
    The only option I see is to serialize the XML, then cut off everything until first ?>.
    Why would you need that, I wonder? May be there is a better way.
    Vlad @ genericparallel.com

  • Need to remove first UsernameToken header on XML document using XSLT

    Can someone help me with an XSLT transformation where i want to remove the first wsse:Security header from my request message. I am not an XSLT expert, so i started playing around with XSLT code but no luck yet.
    My input message Before transformation
    <soapenv:Envelope xmlns:acc="http://wsdl/AccountManagerDocLiteralWrapped/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
       <wsse:Security soapenv:actor="actor1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user1</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       <wsse:Security soapenv:actor="actor2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user2</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <acc:transfer>
             <acc:acctFrom>AC1</acc:acctFrom>
             <acc:acctTo>AC2</acc:acctTo>
             <acc:amount>9</acc:amount>
          </acc:transfer>
       </soapenv:Body>
    </soapenv:Envelope>
    Expected Output after Transformation
    <soapenv:Envelope xmlns:acc="http://wsdl/AccountManagerDocLiteralWrapped/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Header>
       <wsse:Security soapenv:actor="actor2" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
       <wsse:UsernameToken wsu:Id="UsernameToken-1436F53E829718B6F31400871123845250">
       <wsse:Username>user2</wsse:Username>
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
       <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">TAOptcRrjG0vM85BrdbhPw==</wsse:Nonce>
       <wsu:Created>2014-05-23T18:52:03.845Z</wsu:Created>
       </wsse:UsernameToken>
       </wsse:Security>
       </soapenv:Header>
       <soapenv:Body>
          <acc:transfer>
             <acc:acctFrom>AC1</acc:acctFrom>
             <acc:acctTo>AC2</acc:acctTo>
             <acc:amount>9</acc:amount>
          </acc:transfer>
       </soapenv:Body>
    </soapenv:Envelope>
    Appreciate any help with this.
    - dk

    Hi Deepthi,
    Please give the following snippet a try, it should ignore the first occurence of wsse:Security for the output (the first template is used to copy everything into the output, the second template is overruling the first template for the first occurence of wsse:Security and creates an empty output for it):
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <xsl:output omit-xml-declaration="yes"/>
        <xsl:template match="node()|@*">
          <xsl:copy>
             <xsl:apply-templates select="node()|@*"/>
          </xsl:copy>
        </xsl:template>
        <xsl:template match="wsse:Security[1]"/>
    </xsl:stylesheet>

  • How to remove the standalone="yes" attribute in the xml declaration?

    Hi,
    I am using JAXB 2.0 to generate XML files. Can anyone tell me how to remove the standalone="yes" attribute in the xml declaration? Thanks in advance.
    -Joey

    Just open the file with your favorite text program and type away. If you get a permissions problem (file is locked by...) then just stop tomcat and open/edit/save the file and restart tomcat.
    I also think that the admin context that comes with tomcat might allow you to modify/add/edit your users (not sure though)

  • Remove XML Header

    I am developing a Java Servlet and would like to query the database multiple times. I have used OracleXMLQuery and an array to be able to run three separate queries. My problem is occuring in my returned XML Document. Each query comes back with a XML Header such as:
    <?xml version = '1.0'?>
    <Query_1>
    <COL1>10</COL1>
    </Query_1>
    <?xml version = '1.0'?>
    <Query_2>
    <COL1>20</COL1>
    </Query_2>
    <?xml version = '1.0'?>
    <Query_3>
    <COL1>30</COL1>
    </Query_3>
    I have assigned the header separately and would just like to be able to turn off the generated header. My problem is coming when I am trying to use an applet and it does not like when it sees the XML header more than once. Any ideas or hints on how this can be done I would appreciate it.

    Hello this did solve my issue. I have same issue infact. I used this xsl mapping  as
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
    </xsl:stylesheet>
    But my output xml struıcture has broken. Should I  do some changing in my xsl mapping and how ?
    Regards,
    Ceren.

  • Generate XML without header tags in Oracle 9i Release1

    I am a novoice to Oracle. I am using Oracle 9i Release 1.
    I have a table "Attribution" with the following structure.
    SQL> Desc attribution
    Name Null? Type
    REPORT_ID NUMBER
    LABEL VARCHAR2(20)
    VALUE NUMBER(25,10)
    COLOR VARCHAR2(10)
    The inserted values in this table are:
    SQL> select * from attribution;
    REPORT_ID LABEL VALUE COLOR
    24 Allocation .025172879 996699
    24 Selection -.03198432 FF9933
    24 Timing .000016592 8B5A13
    24 Interaction -.0148997 99583D
    24 Derivative Effect -.00026146 CDCD00
    24 Active Return -.02195601 638B45
    24 Active Risk .031745116 800000
    I want to generate an xml without the XML declaration row i.e. <?xml version="1.0"?>
    Also I do not want the <Rowset> tags in my xml.
    My generated XML should be like:
    <set label="Allocation" value="0.4649000000" color="996699"/>
    <set label="Selection" value="-4.3508000000" color="FF9933"/>
    <set label="Timing" value="-0.0022000000" color="8B5A13"/>
    <set label="Interaction" value="-0.4669000000" color="99583D"/>
    <set label="Derivative Effect" value="-0.0184000000" color="CDCD00"/>
    <set label="Active Return" value="-4.3733000000" color="638B45"/>
    <set label="Active Risk" value="1.9901704500" color="800000"/>
    where the value attribute should be equal to values*100.
    Please help me in generating this xml.
    Thanks in Advance
    Jaspreet

    Thanks for your reply.
    Essentially my requirement was to concatinate three sets of xml strings. The application which is parsing my xml requires the XML in the following format:
    XMLStringA + GeneratedXMLfromMyQuery + XMLStringB
    where XMLStringA and XMLStringB are static XML strings and do not change.
    I have generated GeneratedXMLfromMyQuery as from the following query.
    Declare
    qryctx dbms_xmlgen.ctxhandle;
    GeneratedXMLfromMyQuery CLOB;
    Begin
    qryctx := dbms_xmlgen.newcontext('SELECT label "@label", value*100 "@value", color "@color" FROM Attribution order by rownum');
    dbms_xmlgen.setrowtag(qryctx,'set');
    GeneratedXMLfromMyQuery := dbms_xmlgen.getxml(qryctx);
    I can do substring operations on GeneratedXMLfromMyQuery to fetch my required XML and then concatinate it with XMLStringA and XMLStringB,
    XMLOUTPUT := XMLStringA || GeneratedXMLfromMyQuery || XMLStringB ;
    but was keen to know if there is any way by which I can generate GeneratedXMLfromMyQuery without the <?xml version="1.0"?> row and <ROWSET> tags??

  • How to remove the ?xml declaration.

    Hi,
    We are processing a large ASCII input file and converting it into XML. When we do it on a single go, the JVM crashes due to out of memory error.
    We tried to write the XML output for a group of input lines into the file and start processing the next set. We get the <?xml> declarative tag every time we write to the file. How can we remove this?
    Thanks in advance.

    This is how I managed to do it. The latest xerces.xml.serializer package claims to do it as well for various sgml (html/xml etc) but the help is incomplete and I can find nothing on the internet to do this. Historically (ie a year ago) I've seen code such as XMLSerializer s = new XMLSerializer(Properties properties); s.serialize()... But this has been deprecated.
    It seems a great shame to me that Microsoft is running away with decent usable implementations of the DOMDocument standards.
       * Serializes the given document to the writer, optionally omitting the xml declaration
       * @param source
       * @param output
       * @throws XMLException
      public static void transform(Document source, Result output, boolean omitXmlDeclaration)
          throws XMLException
        try {
          if (output == null) {
            throw new IllegalArgumentException("Output result stream cannot be null");
          if (source == null) {
            throw new IllegalArgumentException("Source document cannot be null");
          Transformer transformer = TransformerFactory.newInstance().newTransformer();
          transformer.setOutputProperty("omit-xml-declaration", omitXmlDeclaration ? "yes" : "no");
          transformer.transform(new DOMSource(source), output);
        catch (Exception e) {
          Log.error("Error in transform", e);
          throw new XMLException(e);
      }

  • Remove XML tags from XML element in Oracle

    Hi,
    I have a requirement where I have to remove all the xml tags from xml element with banks, currently I'm using replace 4 times to replace all different types of xml tags, performance is really bad. is there any better option to remove xml tags from xml data leaving the actual data. please find the example data below.
    select
    TO_CLOB(REPLACE(REPLACE(REPLACE(REPLACE
    ('<Concatcolumn><ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>','<ConcatGroupID>'),'<Concatcolumn>'),'</ConcatGroupID>',';'),';</Concatcolumn>')) AS Concatcolumn
    from dual
    **************Out put*************
    MyText Data goes here ;Data agian

    One way is to use xquery:
    SQL> with t as
    select xmltype('<Concatcolumn>
                          <ConcatGroupID>MyText Data goes here </ConcatGroupID><ConcatGroupID>Data agian</ConcatGroupID></Concatcolumn>'
       ) xml from dual
    select xmlquery('string-join(//text(), ";")' passing xml returning content).getclobval() xml from t
    XML                                                              
    MyText Data goes here ;Data agian                                
    1 row selected.

  • How to specify the XML Declaration for an XML variable

    I need to set the XML declaration for my XML variable as
    follows:
    var employees:XML =
    <?xml version="1.0" encoding="utf-8"?>
    <employees>
    <employee ssn="123-123-1234">
    <name first="John" last="Doe"/>
    <address>
    <street>11 Main St.</street>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>98765</zip>
    </address>
    </employee>
    <employee ssn="789-789-7890">
    <name first="Mary" last="Roe"/>
    <address>
    <street>99 Broad St.</street>
    <city>Newton</city>
    <state>MA</state>
    <zip>01234</zip>
    </address>
    </employee>
    </employees>;
    However, if I specify <?xml version="1.0"
    encoding="utf-8"?>, I get a design time and compile error. If I
    remove it it works fine. But the server to which I send this XML is
    expecting the declaration. Can somebody help me with this?
    Thanks

    I work mostly with the Java versions of the parser so you'll have to make the translation to C++. As far as I know, you can't use the SAX API to access to the encoding.
    You need to use the DOM along with Oracle's extension to the basic DOM functionality. Oracle's package, oracle.xml.parser.v2 defines a class which implements the Document interface called XMLDocument. This class has a method, getEncoding(), which returns the encoding. You would use the method in getDocument() in the Parser base class inherited by DOMParser to retrive the XMLDocument.
    Jeff

  • IsSchemaValid does chang the xml-encoding header from UTF-8 to WINDOWS-1252

    I found the following effect:
    isSchemaValid does changing the encoding - entry of the xml-file-header
    generating xml-file by using DBMS_XMLGEN :
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    with the header of the file is
    <?xml version="1.0" encoding="UTF-8"?>
    change the xmldoc to a xmlType
    and validate it against the schema
    xmldoc_xmlType:=(xmltype(xmldoc)) ;
    xmldoc_xmlType.isSchemaValid ( bSchemalocation)
    after this the header of the file is
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    my DB:
    R11_2_0_2 / Windows 64
    the same in
    R11_2_0_1 / Windows 32
    select name, value from v$parameter where upper(name) like '%NLS%'
    nls_calendar     
    nls_comp          BINARY
    nls_currency     
    nls_date_format     
    nls_date_language     
    nls_dual_currency     
    nls_iso_currency     
    nls_language          AMERICAN
    nls_length_semantics     BYTE
    nls_nchar_conv_excp     FALSE
    nls_numeric_characters     
    nls_sort     
    nls_territory          AMERICA
    nls_time_format     
    nls_timestamp_format     
    nls_timestamp_tz_format     
    nls_time_tz_format     
    register my schema by:
    dbms_xmlschema.registerSchema(
    schemaurl => vschemaurl,
    schemadoc => xsd_file,
    local      => FALSE,      
    gentypes      => TRUE,      
    genbean      => FALSE,      
    gentables      => TRUE,      
    force      => FALSE,
    owner      => dbuser
    ,CSID      => nls_charset_id('AL32UTF8')
    How can I let or change back the xml-encoding entry to UTF-8 ?
    regards

    Your solution should not be relied upon...
    C:\Temp>sqlplus /nolog @t1 %CD%
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 4 09:41:32 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def XMLDIR = &1
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:00:00.24
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.07
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> create or replace directory XMLDIR as '&XMLDIR'
      2  /
    old   1: create or replace directory XMLDIR as '&XMLDIR'
    new   1: create or replace directory XMLDIR as 'C:\Temp'
    Directory created.
    Elapsed: 00:00:00.00
    SQL> create table XML_DEFAULT of XMLTYPE
      2  /
    Table created.
    Elapsed: 00:00:00.11
    SQL> create table XML_CLOB of XMLTYPE
      2  XMLTYPE store as CLOB
      3  /
    Table created.
    Elapsed: 00:00:00.01
    SQL> select *
      2    from nls_database_parameters
      3   where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET')
      4  /
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CHARACTERSET               AL32UTF8
    Elapsed: 00:00:00.02
    SQL> declare
      2    XML_DEFAULT XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      3    XML_CLOB    XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      4  begin
      5    delete XML_DEFAULT;
      6    delete XML_CLOB;
      7    insert into XML_DEFAULT values (XML_DEFAULT);
      8    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT.xml');
      9    IF  XML_DEFAULT.isSchemaValid ( 'SCHEMALOCATION_DOES_NO_MATTER_FOR_TEST_CASE.XSD', 'SCHEMA_NO_MATTER') = 1 THEN  null; ELSE  null; END IF;
    10    commit;
    11    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_IS_VALID.xml',nls_charset_id('WE8MSWIN1252'));
    12    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_WIN1252.xml');
    13    insert into XML_CLOB values (XML_CLOB);
    14    dbms_xslprocessor.clob2file( XML_CLOB.getclobval() , 'XMLDIR','XML_CLOB.xml');
    15    commit;
    16  end ;
    17  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.27
    SQL> --
    SQL> host type XML_DEFAULT.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_IS_VALID.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_WIN1252.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_CLOB.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL>First, the character set changes because isSchemaValid() causes the document to be parsed and converted to the internal database character set, as does storing it in a table.
    It appear that your solution works in SQL because the semantics of SQL are such that it causes a 'copy' of the XMLType to take place before running the isSchemaValid() processing, were we to optimize away that copy as a result of a patch or performance optimization project then you solution would break...
    If you want the output in a particular character set you should force that using XMLSerialize or getBlobVal(charsetid). Unfortunately we don't have a convience method for writing BLOBS on DBMS_XSLPROCESSOR...

  • Xml declaration with whitespace leading..

    hi,,,,, we use SOAP message (SOAP with attachments..) to exchange some informations..
    the problem is that our client sends SOAP message like this.. (we captured HTTP input..)
    POST /mms/service HTTP/1.0
    Content-Type: multipart/related; boundary="NextPart_000_0125_01C19839.7237929064"; type="text/xml"; start="<0406262209010000000003>"
    Content-Length: 14687
    SOAPAction: ""
    --NextPart_000_0125_01C19839.7237929064
    Content-Type: text/xml
    Content-ID: <0406262209010000000003>
    <?xml version="1.0" encoding="euc-kr" ?>
         <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
         <env:Header>
    as you can see,, xml declaration has leading whitespaces..
    and, our XML library (crimson or xerces) throws SAXParseException: "XML declaration may begin entities"
    ofcourse, we should remove leading whitespaces.. but,,, unfortunately it's not an easy work for some reason.
    is there any other way.... let crimson or xerces ignore leading whitespaces.. or any other tolerant parsers ?
    thanks very much for any replies..

    sorry,, i missed pre tag.. the exact HTTP input is like below..
    <pre>
    POST /mms/service HTTP/1.0
    Host: 211.39.152.216
    Content-Type: multipart/related; boundary="NextPart_000_0125_01C19839.7237929064"; type="text/xml"; start="<0406262209010000000003>"
    Content-Length: 14687
    SOAPAction: ""
    --NextPart_000_0125_01C19839.7237929064
    Content-Type: text/xml; charset="euc-kr"
    Content-ID: <0406262209010000000003>
    <?xml version="1.0" encoding="euc-kr" ?>
         <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
         <env:Header>
    </pre>

  • How to specify XML declaration in an XML Variable

    I had posted this question in the Flex Builder discussion,
    but I am not sure if that was the right board, so posting it again
    here:
    I need to set the XML declaration for my XML variable as
    follows:
    var employees:XML =
    <?xml version="1.0" encoding="utf-8"?>
    <employees>
    <employee ssn="123-123-1234">
    <name first="John" last="Doe"/>
    <address>
    <street>11 Main St.</street>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>98765</zip>
    </address>
    </employee>
    <employee ssn="789-789-7890">
    <name first="Mary" last="Roe"/>
    <address>
    <street>99 Broad St.</street>
    <city>Newton</city>
    <state>MA</state>
    <zip>01234</zip>
    </address>
    </employee>
    </employees>;
    However, if I specify <?xml version="1.0"
    encoding="utf-8"?>, I get a design time and compile error. If I
    remove it it works fine. But the server to which I send this XML is
    expecting the declaration. How can I set the declaration?
    Any help or pointer is appreciated.

    I am not able to load the xml. Can anybody figure out the
    problem :
    I have used a LoadXML class :
    package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    // Demonstrates the code required to load external XML
    public class LoadXML extends Sprite {
    // The property that will eventually contain the loaded XML
    private var novel:XML;
    // The object used to load the XML
    private var urlLoader:URLLoader;
    // Constructor
    public function LoadXML () {
    // Specify the location of the external XML
    var urlRequest:URLRequest = new URLRequest("novel.xml");
    // Create an object that can load external text data
    urlLoader = new URLLoader();
    // Register to be notified when the XML finishes loading
    urlLoader.addEventListener(Event.COMPLETE,
    completeListener);
    // Load the XML
    urlLoader.load(urlRequest);
    // Method invoked automatically when the XML finishes
    loading
    private function completeListener(e:Event):void {
    // The string containing the loaded XML is stored in the
    URLLoader
    // object's data property (urlLoader.data). To create a new
    XML
    // instance from that loaded string, we pass it to the XML
    constructor
    novel = new XML(urlLoader.data);
    trace(novel.toXMLString()); // Display the loaded XML, now
    converted
    // to an XML object
    And in main.mxml :
    myXml = new LoadXml ;
    trace ( myXml.novel ) ;
    The output is errenous

Maybe you are looking for