Dynamic XSLT Sort Routine to XML (NCName:* or QName was expected)

I am trying to create a XSLT Stylesheet to perform dynamic sorts (via parameters) on XML data with the desired output being XML... I've declared everything static in my StyleSheet for debugging purposes:
XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<Content>
<task:TASK id="25"
src:col="/db/iconnect/MappingCenterCRM/default/TASK"
src:key="25" xmlns:src="http://xml.apache.org/xindice/Query" xmlns:task="http://iconnect.com/schemas/task">
<task:user_id>123</task:user_id>
<task:long_description>This is my description...</task:long_description>
<task:priority>1</task:priority>
<task:status>Completed</task:status>
</task:TASK>
<task:TASK id="26"
src:col="/db/iconnect/MappingCenterCRM/default/TASK"
src:key="26" xmlns:src="http://xml.apache.org/xindice/Query" xmlns:task="http://iconnect.com/schemas/task">
<task:user_id>123</task:user_id>
<task:long_description>Another description...</task:long_description>
<task:priority>1</task:priority>
<task:status>New</task:status>
</task:TASK>
</Content>
Here is my Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:task="http://iconnect.com/schemas/task" xmlns:src="http://xml.apache.org/xindice/Query">
<xsl:output method="xml" />
<xsl:param name="sortBy" select="task:long_description" />
<xsl:param name="xPath" select="//Content/task:TASK" />
<xsl:param name="orderByType" select="ascending" />
<xsl:template match="$xPath | node()">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="$sortBy" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When I run in XMLSpy, I get the desired results, but when running using Xerces, I get the following error:
javax.xml.transform.TransformerException: A node test that matches either NCName:* or QName was expected.

I am trying to create a XSLT Stylesheet to perform dynamic sorts (via parameters) on XML data with the desired output being XML... I've declared everything static in my StyleSheet for debugging purposes:
XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<Content>
<task:TASK id="25"
src:col="/db/iconnect/MappingCenterCRM/default/TASK"
src:key="25" xmlns:src="http://xml.apache.org/xindice/Query" xmlns:task="http://iconnect.com/schemas/task">
<task:user_id>123</task:user_id>
<task:long_description>This is my description...</task:long_description>
<task:priority>1</task:priority>
<task:status>Completed</task:status>
</task:TASK>
<task:TASK id="26"
src:col="/db/iconnect/MappingCenterCRM/default/TASK"
src:key="26" xmlns:src="http://xml.apache.org/xindice/Query" xmlns:task="http://iconnect.com/schemas/task">
<task:user_id>123</task:user_id>
<task:long_description>Another description...</task:long_description>
<task:priority>1</task:priority>
<task:status>New</task:status>
</task:TASK>
</Content>
Here is my Stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:task="http://iconnect.com/schemas/task" xmlns:src="http://xml.apache.org/xindice/Query">
<xsl:output method="xml" />
<xsl:param name="sortBy" select="task:long_description" />
<xsl:param name="xPath" select="//Content/task:TASK" />
<xsl:param name="orderByType" select="ascending" />
<xsl:template match="$xPath | node()">
<xsl:copy>
<xsl:apply-templates>
<xsl:sort select="$sortBy" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
When I run in XMLSpy, I get the desired results, but when running using Xerces, I get the following error:
javax.xml.transform.TransformerException: A node test that matches either NCName:* or QName was expected.

Similar Messages

  • Dynamic XSLT source code generation based upon internal table

    Hi,
    Is there anyway to generate dynamic XSLT source code based upon final structure of output internal table and call dynamic generated XSLT in program?
    CALL TRANSFORMATION z_transformation
                PARAMETERS
                 p_shared_string = lo_shared_str_nodeset
                SOURCE XML g_sheet_data
                RESULT lt_data = i_data[].
    Source code example of XSLT transformation -
    <xsl:template match="/">
         <asx:abap version="1.0">
           <asx:values>
             <LT_DATA>   "Internal table
               <xsl:for-each select="ss:worksheet/ss:sheetData/ss:row">
                 <xsl:if test="position() &gt; 1">
                   <item>
                     <FIELD1>
                       <xsl:variable name="cell_id" select="concat('A', position())"/>
                       <xsl:variable name="v_index" select="ss:c[@r=$cell_id][@t='s']/ss:v"/>
                       <xsl:if test="$v_index">
                         <xsl:value-of select="$V_SHARED_STRING/sst/si[$v_index + 1]/t"/>
                       </xsl:if>
                       <xsl:if test="not($v_index)">
                         <xsl:value-of select="ss:c[@r=$cell_id]/ss:v"/>
                       </xsl:if>
                     </FIELD1>
                 </item>
                 </xsl:if>
               </xsl:for-each>
             </LT_DATA> "internal table
           </asx:values>
         </asx:abap>
       </xsl:template>
    </xsl:transform>

    In addition,
    We are converting binary data of excel from application server into internal table but currently we created two XSLT transformation to achieve this one for deleting name space and other for converting data into internal table format.
    We want to make our source code for future use also,Is there anyway to generate XSLT source code dynamically?Above mentioned code is snippet of data extracting which we are doing but this transformation is hard coded.
    Any help is appreciated.
    BR,
    Praveen

  • XSLT problem passing raw XML

    Hello,
    I've a problem passing a piece of raw XML code to an external assembly to do some tasks.
    The problem is that if I use an XSLT like this:
    <xsl:template name="xml-to-string-called-template">
       <xsl:param name="param1" />
              <xsl:element name="ns0:Root">
                  <xsl:variable name="tryThisTemplate">
                      <xsl:text disable-output-escaping="yes"></xsl:text>
                          <xsl:call-template name="identity" />
                      <xsl:text disable-output-escaping="yes"></xsl:text>
                  </xsl:variable>
    <xsl:copy-of select="$tryThisTemplate" />
               </xsl:element>
    </xsl:template>
    <xsl:template name="identity" match="@*|node()">
       <xsl:copy>
    <xsl:apply-templates select="@*|node()" />
       </xsl:copy>
     </xsl:template>
    I have as output the XML with all tags like expected (the TestFunction take a string as input ad return the same string as output), like this:
    <ns0:Root xmlns:ns0="http://BizTalk_Server_ProjectDemo.SchemaOut1Node">
    - <ns0:Travel xmlns:ns0="http://BizTalk_Server_ProjectDemo.SchemaIN">
      <DateTimeStart>1999-05-31T13:20:00.000-05:00</DateTimeStart>
      <Field>Field_0</Field>
      </ns0:Travel>
     </ns0:Root>
    The problem is that if I try to pass the variable to my external assembly, in this way:
    <xsl:template name="xml-to-string-called-template">
       <xsl:param name="param1" />
              <xsl:element name="ns0:Root">
                  <xsl:variable name="tryThisTemplate">
                      <xsl:text disable-output-escaping="yes"></xsl:text>
                          <xsl:call-template name="identity" />
                      <xsl:text disable-output-escaping="yes"></xsl:text>
                  </xsl:variable>
                  <xsl:variable name="pCC" xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0"
    select="ScriptNS0:TestFunction($tryThisTemplate)" />
                    <xsl:text disable-output-escaping="yes"></xsl:text>
    <xsl:copy-of select="$pCC" />
                    <xsl:text disable-output-escaping="yes"></xsl:text>
               </xsl:element>
    </xsl:template>
    saving its return value and printing it, I have as output the values of fields contained in $tryThisTemplate variable, and not all the XML like I need:
    <ns0:Root xmlns:ns0="http://BizTalk_Server_ProjectDemo.SchemaOut1Node">1999-05-31T13:20:00.000-05:00
    Field_0</ns0:Root>
    What can I do to pass all the raw XML to my function and not the values of its fields?
    I tried to declare the output method as like xml than html or text but nothing changed

    First, of all your input xml has invalid namespace declaration, is this like below what mean to say:
    <ns0:Root xmlns:ns0="http://BizTalk_Server_ProjectDemo.SchemaOut1Node">
      <ns1:Travel xmlns:ns1="http://BizTalk_Server_ProjectDemo.SchemaIN">
        <DateTimeStart>1999-05-31T13:20:00.000-05:00</DateTimeStart>
        <Field>Field_0</Field>
      </ns1:Travel>
    </ns0:Root>
    Second, you can achieve what you are trying to map using very simple map like below:
    and you can see the xslt is generated like below:
    <?xml version="1.0" encoding="UTF-16"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 userCSharp" version="1.0" xmlns:s0="http://BizTalk_Server_ProjectDemo.SchemaIN" xmlns:ns0="http://BizTalk_Server_ProjectDemo.SchemaOut1Node" xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />  <xsl:template match="/">    <xsl:apply-templates select="/ns0:Root" />  </xsl:template>  <xsl:template match="/ns0:Root">    <xsl:variable name="var:v1" select="userCSharp:StringConcat(string(s0:Travel/DateTimeStart/text()) , &quot;  &quot; , string(s0:Travel/Field/text()))" />    <ns0:Root>      <xsl:value-of select="$var:v1" />    </ns0:Root>  </xsl:template>  <msxsl:script language="C#" implements-prefix="userCSharp"><![CDATA[public string StringConcat(string param0, string param1, string param2){   return param0 + param1 + param2;}]]></msxsl:script></xsl:stylesheet>
    Third, if you are really interested passing your whole using xslt, then probably this artical will be helpful to you
    http://connectedpawns.wordpress.com/2009/08/01/how-to-copy-the-entire-node-to-element-of-string-type-in-a-map/
    Please mark it as Answer if this answers your question
    Thanks.
    Mo
    The contents I write here is my personal views, not the view of my employer and anyone else.
    Thank you, yes you're right about the namespaces, but this is only a proof of concept ant I have to adjust it.
    What is the functoid you put in the map? And can I pass its output to an external assembly as parameter? (I need to do it and return the output to a certain schema node).
    Thank you

  • Sorting Attributes in XML in JDOM

    how wud I sort children of an element in a order.
    ex:
    <root>
    <name="A" value="4">
    <name="B" value="2">
    <name="C" value="3">
    <name="D" value="1">
    <root>
    result:
    <root>
    <name="D" value="1">
    <name="B" value="2">
    <name="C" value="3">
    <name="A" value="4">
    <root>
    how wud i get it in sorted order (for value attribute)using JDOM.

    JDOM does not have a class/method for sorting.
    The XML document may be parsed with XPath and sorted elements added to another document.

  • Change a attribute value with XSLT before importing an XML

    I need change the attribute value with XSLT before importing an XML
    <table class="x" style="width="50pt">...
    I have to divide by 200 the value of "width", and the result multiplied by 100:
    (50/200) * 100
    It's possible with a XLST?

    Hi,
    Yes you can do this via XSLT.
    You can try similar to the one below:
    <table>
       <xsl:attribute name="width">
         <xsl:value-of select="((./width) div 200)*(100)" />
       </xsl:attribute>
    </table>
    I have not tested yet... Try it....
    Green4ever
    (I am back after long time)....

  • Apply XSLT  while importing the xml to the selected node in structure view

    Hi All,
    I would like to apply XSLT while importing the xml file to the selected node in the structure view.
    How to go about it?
    Thanks
    Sakthi

    Hi All,
       Got the solution,
                    UIDRef documentUIDRef = ::GetUIDRef(activeContext->GetContextDocument());
                InterfacePtr<IDocument> document(documentUIDRef, UseDefaultIID());
                InterfacePtr<IXMLImportOptionsPool> prefsPool( document->GetDocWorkSpace(), UseDefaultIID() );
                InterfacePtr<IK2ServiceRegistry> serviceRegistry(gSession, UseDefaultIID());
                InterfacePtr<IK2ServiceProvider> serviceProvider(serviceRegistry->QueryServiceProviderByClassID(kXMLImportMatchMakerSignal Service,     kXMLThrowAwayUnmatchedRightMatchMakerServiceBoss));
                InterfacePtr<IXMLImportPreferences> prefs(serviceProvider, IID_IXMLIMPORTPREFERENCES);
                XMLImportPreferencesInitializer initializer(prefs, prefsPool);
                bool16 prefBool = prefs->GetNthPrefAsBool(0);
                prefs->SetNthPref(0, kTrue);
    The above code set the import option "Delete elements, frames, and content that do not match imported XML"
    Thanks
    Sakthi

  • Dynamic Row Sorting

    I have a page that lists all of the rows in a particular table initially sorted by an integer key thanks to an ORDER BY clause in the VO query. If a user modifies the integer key of a row, the row should move to its appropriate position within the list.
    Is there a way to dynamically alter the order of rows in an ADF databinding iterator? I know the list will be resorted if I executeQuery() on the VO, but I wish to avoid that because it also resets the row currency.
    Thanks.

    By your description it looks like in your case you could handle it by static query and conditions on columns, it would avoid the issue altogether... But I am not sure I understood correctly.
    I got my dynamic query sorting to work by using custom headings - but that requires static list and order of columns so it wouldn't work for you.
    Kaja

  • OSB Dynamically XSLT transformation

    Hello!
    XSLT is stored in the database.
    I getting xslt from db via EJB.
    How can use this xslt for transformation in osb? Can use standard snippet for transformation?
    Thanks,
    lam

    Already discussed here.
    OSB: Dynamic XSLT
    Thanks,
    Vijay

  • XSLT transformation not working in 1.5 (but was in 1.4)

    Gentlemen,
    I have a problem with some code that worked fine under 1.4 (at least up to 1.4.2_06), but now no longer works under 1.5.0 (I know this isn't the most recent, but I have yet to update).
    I use the following XSL template in order to take a string containing a valid XML definition, strip out all whitespace (this is ok, I know I dont need it), and then indent it in a nice readable format.
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="1.0" xmlns:xalan="http://xml.apache.org/xslt">
      <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" xalan:indent-amount="2"/>
        <xsl:strip-space elements="*"/>
          <xsl:template match="@*|node()">
            <xsl:copy>
              <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
          </xsl:template>
    </xsl:stylesheet>The code I use to perform the transformation is as follows :
    // read the XML string into a DOM document structure
    StringReader reader = new StringReader(xmlString);
    InputSource source = new InputSource(reader);
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(source);
    // Input file to be transformed is the DOM document we have just created
    Source input = new DOMSource(doc);
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(new StringReader(TEMPLATE_AS_DEFINED_ABOVE)));
    // create output writer and transform
    StringWriter writer = new StringWriter();
    transformer.transform(input, new StreamResult(writer));
    System.out.println(writer.toString());As already stated, this produced the goods, in 1.4.2_06, but in 1.5.0 it results in the following error :
    java.lang.NullPointerException
         at gnu.xml.aelfred2.SAXDriver.getLineNumber(SAXDriver.java:1165)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parseTopLevel(Parser.java:1077)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.parsePattern(Parser.java:1067)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Template.parseContents(Template.java:213)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseOwnChildren(Stylesheet.java:590)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.parseContents(Stylesheet.java:562)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.Parser.createAST(Parser.java:380)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:325)
         at com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.java:410)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:791)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
         at com.ingenico.tests.ReportTest.prettifyXMLString(ReportTest.java:231)
         at com.ingenico.tests.ReportTest.<init>(ReportTest.java:100)
         at com.ingenico.tests.ReportTest.main(ReportTest.java:136)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
    ERROR:  'null'
    FATAL ERROR:  'Could not compile stylesheet'
    Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
         at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
         at com.ingenico.tests.ReportTest.prettifyXMLString(ReportTest.java:231)
         at com.ingenico.tests.ReportTest.<init>(ReportTest.java:100)
         at com.ingenico.tests.ReportTest.main(ReportTest.java:136)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)I have a headache now and would appreciate some help - not with the headache, but the above error! :)
    Cheers in advance,
    Lee.

    have you tried to remove the xalan specific entries
    in the XSL and use that code:
    transformer.setOutputProperty("{http://xml.apache.org/
    xslt}indent-amount", "2");?Thanks for the reply.
    Unfortunately, Ive already tried this, and it's not the problem.
    If I remove the whole <xsl:template match /> section from the template, then the compilation error does not occur. I guess this narrows it down somewhat, but I don't know why that section is now failing under 1.5. (Ive since also tried with 1.5.0_03 - same error).

  • Org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x80) was found in the CDATA section

              Hi,
              I,'m using c.tld tag libraries from Yakarta in order to use c:if functions.
              When I use non-unicode characters in my JSP pages, it crashes:
              java.io.IOException: javax.servlet.jsp.JspException: The taglib validator rejected
              the page: "org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x80)
              was found in the CDATA section., "
                   at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:124)
                   at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:258)
                   at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:353)
                   at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:211)
                   at weblogic.servlet.jsp.JspStub.checkForReload(JspStub.java:149)
                   at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:521)
                   at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:351)
                   at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
                   at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5445)
                   at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
                   at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3105)
                   at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2588)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
              How can I force it to use ISO-8859-1? All my tries haven't work. What should I
              do? The c.tld libraries and jars are taken from JDK 1.4.1_02
              

    Hi Stefan,
       This is my source xml in moni..
    xmlns:prx="urn:sap.com:proxy:ECP:/1SAI/TAS5BFDF495190544E4B506:701:2008/06/06">
      <SiteId>0080</SiteId>
      <UCC>42027519 91029010015</UCC>
    My interface is SAP(Proxy) to Database(Synchronous).
       SAP (PROXY) --> PI --> DATABASE ( Synchronous Communication )
    Let me know if u need any information from my side...
    Thanks for ur help...
    Thanks,
    Siva..

  • Error in moni as invalid XML character (Unicode: 0x16) was found

    Hello Experts,
    I am facing an issue in Production interface is Proxy - -> JDBC data is passing in ECC successfully in PI moni it is showing error
    as                  Runtime Exception when executing application mapping program com/sap/xi/tf/_MaterialPlantFromSAP_to_MaterialPlantToDYNAMINE_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; An invalid XML character (Unicode: 0x16) was found in the element content of the document.
    when i try to open the payload it is showing data is too long when i click on open screen is getting hang showing as not responding.I have checked in the ECC it is also showing data is too long when i click on open after 1 min payload is opening when i try to copy the payload and paste in Message mapping test tab again screen is getting hanging when i try to test with 20 or 30 records in Mapping it going through.
    I have downloaded that XML file from ECC moni it is 8.83 MB .
    PI can process this huge file ? please suggest me how to pass data in chunks .And also i am not understanding error is due to Payload has not correct data or Payload is huge.
    Please throw some light on the issue any help is highly appreciated.
    Regards
    Praveen Reddy

    Hi Praveen,
                       you need a HEX editor. Please download one from this link
    http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm
    Here in the editor search for the HEX value 0X16 and see the corrosponding charcater in payload.
    Try getting rid of the character before it reaches Integrtaion engine possibly with java mapping.
    Regards
    Anupam
    Edited by: anupamsap on Jan 4, 2012 6:43 PM

  • An invalid XML character (Unicode: 0x0) was found in the prolog of the docu

    Hi folks,
    I'm using the SAX parser to parse a small xml file. If I use that file in IE, there its parsing correctly and displaying the xml in the tree structure.
    But in my Java code its throwing
    org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the prolog of the document.
    The xml parsing code of my program is
    XMLReader parser = XMLReaderFactory.createXMLReader(
    "org.apache.xerces.parsers.SAXParser");
    HelpPartHandler hp = new HelpPartHandler();
    parser.setContentHandler(hp);
    RandomAccessFile raf = new RandomAccessFile("sample.xml","r");
    byte Contents[] = new byte[(int)raf.length()];
    StringReader sr = new StringReader(new String(Contents));
    InputSource is = new InputSource(sr);
    parser.parse(is);
    The xml file is
    <?xml version="1.0"?>
    <ROOT>
    <NODE> Java </NODE>
    </ROOT>
    Please let me know the mistakes what I have done. Looking for the reply.
    Thanks in Advance
    Prabu

    The message seems clear to me. Your document contains a null character, which is not valid in an XML document. Take it out of the document, and change whatever produced the document to not put it there. (I hope you don't consider Microsoft software to be standards-compliant.)

  • Com.sap.aii.utilxi.misc.api.BaseRuntimeException:An invalid XML character (Unicode: 0x1f) was found in the element content of the document

    Hi,
    I'm getting the below runtime exception during IDOC- SOAP message mapping in Integration engine.
    "Runtime exception occurred during application mapping com/sap/xi/tf/<<<\\Message mapping object name\\>>>; com.sap.aii.utilxi.misc.api.BaseRuntimeException:An invalid XML character (Unicode: 0x1f) was found in the element content of the document"
    I have no clue why this exception occurs. Could anyone say the reason of the exception?
    Thanks!
    Regards,
    Gopi

    Hi Gopinath
    Check this thread
    An invalid XML character (Unicode: 0x1d) was found in the element
    Kind regards
    Javi

  • BAPI_PO_GETDETAIL1 - An invalid XML character (Unicode: 0xb) was found

    Hi,
    We are using BAPI_PO_GETDETAIL1 to get the Purchase Order details. it worked well in the past.
    But its failing for a particular PO number.
    Error Message:An invalid XML character (Unicode: 0xb) was found in the element content of the document.
    I understand there might be some special character in the record. But it works well at SAP ECC.
    Can someone please suggest some solution or workaround?
    Thanks,
    Anil

    Hi,
    I faced the same issue recently, and came accross this sap note : 1559677 : XML renderer creates invalid XML.
    Take a few moments to read the contents, but here's the most important part :
    If an application program uses the SAP XML renderers to create XML 1.0
    documents that must strictly conform to the specifications of W3C, this
    application program must ensure that problematic characters are removed
    from the data before transferring this data to the SAP XML renderer.
    So, you need to clean up the characters by yourself...
    Best regards,
    Wouter

  • An invalid XML character (Unicode: 0x15) was found  ERROR

    I AM TRYING TO USE JAXB TO UNMARSHAL XML FILE AND GET FOLLOWING ERROR.
    PLEASE HELP.
    THANKS IN ADVANCE
    [java] org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    [java] DefaultValidationEventHandler: [FATAL_ERROR]: An invalid XML character (Unicode: 0x15) was found in the element content of the document.
    [java] Location:
    [java]      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
    [java]      at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:213)
    [java]      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:385)
    [java]      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:315)
    [java]      at org.apache.xerces.impl.XMLScanner.reportFatalError(XMLScanner.java:1294)
    [java]      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1500)
    [java]      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:348)
    [java]      at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:539)
    [java]      at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:595)
    [java]      at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    [java]      at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1125)
    [java]      at grants.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:142)
    [java]      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
    [java]      at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:178)
    [java]      at Transfer.main(Transfer.java:20)

    You made the file? Then fix the program that makes it so that it doesn't put that character into the file. Standard XML processors like those used by JAXP will never create invalid XML, so why not use them?

Maybe you are looking for

  • I can view files I don't have permission to view!

    OK so here is the setup: Mac Mini Server with a Drobo connected. 4 folders on the root of the Drobo all shared. Permissions on 3 of the folders are set to me as owner and everyone else as no access. the 4th folder is set up as me as owner and group a

  • Search not working in music library with newest update

    since the iTunes update, I cannot type anything in the search box when looking in my music library.  Anyone have this issue? any cures??

  • Can we create a view involving a standard table and a ZTable ?

    Hi, I created a view based on 2 tables : EKKO and a Ztable having EBELN field in common. Now, when i try to create a PO in ME21N , this view should get updated.But,It doesn't happen so. So i want to confirm that is it not possible to create a view on

  • Certain web pages cannot be accessed with Satellite Pro 4600

    Installed a new hard drive and Windows 2000 in my laptop and now have a bizarre problem. Both Ie6 and Firefox can get to some websites e.g. Google (which I can search on and get results), some UK & US sites, toshiba support page etc. but I can't get

  • Failed to upgrade to Leopard Help!

    Failed to upgrade to Leopard from a 10.4.11 to 10.5.2 Okay, unless there are different kinds of Leopard other then Single and family pack, however i don't think that would matter? Or software that comes for the laptop is different to Desktop? My uncl