XML Document parsing issue

Hello I am doing some SOAP XML stuff and I am having an issue that hopefully I can get some help with.
Is XML like this valid to do in a SOAP message?
<prompt>1 &_lt_; 0? <prompt>It's suppose to represent "1 < 0?"
* the forum formatter seems to eat up my encoded text and transofrms it into acutal "<" so I am placing underscores "_" everywhere to keep the text. so above is actually without underscores
From what I've read I think it is. I have text like this transported as part of the overall SOAP message to my client from the server.
In my code I do:
// Create an instance of the DocumentBuilderFactory
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
// Get the DocumentBuilder from the factory
DocumentBuilder builder = documentFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
...inputStream is an InputStream (specifically ByteArrayInputStream) containing the XML.
The issue I am having is that wherever I have an '&' (such as "&_lt_;" or "&_gt_;" or "&" etc...) the parsing seems to get cut off and the rest of the string doesn't seem to get parsed. So the above string "1 &_lt_; 0?" ends up being "1 ".
Also is there an easy way to get back or rebuild the XML into a string from a Document object? I would really like to do that right after I do the parse method and see if the XML data that the Document object has is the same as what's in the inputStream (which is "1 &_lt_; 0?").
Any input you can provide is much appreciated. Thanks,
Latem

Hello I am doing some SOAP XML stuff and I am having an issue that hopefully I can get some help with.
Is XML like this valid to do in a SOAP message?
<prompt>1 &_lt_; 0? <prompt>It's suppose to represent "1 < 0?"
* the forum formatter seems to eat up my encoded text and transofrms it into acutal "<" so I am placing underscores "_" everywhere to keep the text. so above is actually without underscores
From what I've read I think it is. I have text like this transported as part of the overall SOAP message to my client from the server.
In my code I do:
// Create an instance of the DocumentBuilderFactory
DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
// Get the DocumentBuilder from the factory
DocumentBuilder builder = documentFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
...inputStream is an InputStream (specifically ByteArrayInputStream) containing the XML.
The issue I am having is that wherever I have an '&' (such as "&_lt_;" or "&_gt_;" or "&" etc...) the parsing seems to get cut off and the rest of the string doesn't seem to get parsed. So the above string "1 &_lt_; 0?" ends up being "1 ".
Also is there an easy way to get back or rebuild the XML into a string from a Document object? I would really like to do that right after I do the parse method and see if the XML data that the Document object has is the same as what's in the inputStream (which is "1 &_lt_; 0?").
Any input you can provide is much appreciated. Thanks,
Latem

Similar Messages

  • Xml document parser

    I have the java source code for a SAX compiler to parse my XML document.
    To make this work I was told to include the following in my classpath: -
    �     j2sdk1.4.1_01/jaxp-1.1/jaxp.jar
    �     j2sdk1.4.1_01/jaxp-1.1/xalan.jar
    �     j2sdk1.4.1_01/jaxp-1.1/crimson.jar
    by the way I have got j2sdk1.4.1_01!!
    I have also got another java file which is a java class that calls my parser.java file. When I compile the java class file I get weird errors such as:
    "Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value '1.3', but '1.4' is required.
    ERROR: could not find java.dll
    ERROR: could not find Java 2 Runtime Environemnt.
    This is the code for my java class:
    import java.io.*;
    import java.util.*;
    public class testXML {
    public static void main(final String[] pArgs) throws IOException {
    new CustomerParser("flock.xml");
    I'm pretty new to this parsing business, and Im really not sure what to do.
    1)is it my java software playing up?
    2)or is it my classpath?
    3)or what?
    hope someone can help, Jim.

    Find the old version of java.exe that's running and get rid of it. (or remove the pathe entry)

  • XML Document parse base dir

    Hy is there anyway to specify a base dir when parsing a document? Have a doctype defined that references a XML file but the file is relative to the parsing document.
    Example :
    <!DOCTYPE something [
    <!ENTITY fileRef SYSTEM "file:./util/otherFile.xml">
    ]>
    <something>
    &fileRef ;
    </something>
    When parsing this document i get the following exception "java.io.FileNotFoundException: ./util/otherFile.xml (The system cannot find the path specified)". Though the file is in the specified directory.
    Another question i have is if it's possible to make any reference to any system environment variables from within an XML document.
    Thanx,
    Daniel Campelo

    Yes, call the setSystemId() method on the InputSource you are giving to the parser. Remember you have to give it a URI, not a path name. (The File class has a method to return the URI of a file path.)
    And sure, you can refer to system environment variables in an XML document. Just don't expect those things to be treated any differently than any other text. If you want them to be replaced by the value of the environment variables, for example, you have to do that yourself.

  • Get XML Document Data Issue

    After tweak bunch of times the argument inside "Get XML Document Data" I´m still not able to obtain a no null value. Could someone help me to find out what i´m doing wrong?
    <?xml version="1.0" encoding="UTF-8"?>
    <Holidays>
      <Holiday>Date=1/2/2013</Holiday>
      <Holiday>Date=1/2/2013</Holiday>
      <Holiday>Date=8/4/2013</Holiday>
      <Holiday>Date=9/4/2013</Holiday>
      <Holiday>Date=1/5/2013</Holiday>
      <Holiday>Date=17/5/2013</Holiday>
      <Holiday>Date=27/5/2013</Holiday>
      <Holiday>Date=6/6/2013</Holiday>
      <Holiday>Date=23/6/2013</Holiday>
      <Holiday>Date=6/4/2013</Holiday>
      <Holiday>Date=25/12/2013</Holiday>
      <Holiday>Date=26/12/2013</Holiday>
    </Holidays>
    Xpath:
    "/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"
    thank in advance.

    Hi,
    The script first obtain today´s date in this format 1/2/2013 and stores in DateString variable. Then create a XML document based on this:
    <?xml version="1.0" encoding="UTF-8"?>
      Date=1/2/2013
      Date=1/2/2013
      Date=8/4/2013
      Date=9/4/2013
      Date=1/5/2013
      Date=17/5/2013
      Date=27/5/2013
      Date=6/6/2013
      Date=23/6/2013
      Date=6/4/2013
      Date=25/12/2013
      Date=26/12/2013
    that i´ve upload to uccx. it uses get XML Document Data function and stores the result in DataResult variable.
    if
    DataResult == null meets True it makes a call redirect to an extension
    if false that means "1/2/2013" was found inside the XML archive and sends to another extension.
    The problem i see through reactive debug is that always return null,
    In brief: I do not know how to tell using the function "find 1/2/2013 inside Holidays.xml document"
    this is what I putted inside get XML Document Data function:
    "/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"

  • RFC to XML-RFC Parsing issue in RFC Adapter as Sender

    Hi all,
    I tried to use RFC adapter as a sender. The scenario I am trying to achieve is R3 -> RFC Adapter Sender --> BPM --> RFC Adapter Receiver --> SAP Auto-ID system.
    The reason to use two RFC adapter and BPM is to log the request message if the RFC call fails. Everything works as expected, except the RFC Adapter Sender.
    The RFC I am calling has an input table. The input data I use works fine if I call it via SE37 or remotely from another SAP system. However, if I call it via RFC adapter, when XI parses the data into RFC-XML format, the input data is all messed up.
    DATA: BEGIN OF ID_STR,
            ID_VERSION(8)       TYPE C,
            ID(96)              TYPE C,
            ELEMENT_NAME(50)    TYPE C,
            ELEMENT_VALUE(128)  TYPE C,
          END OF ID_STR.
    DATA: it_id LIKE TABLE OF ID_STR,
          ls_id LIKE ID_STR.
    ls_id-ID_VERSION = 'EPC_1.30'.
    ls_id-ID = '30340242206DC3C00000000A'.
    ls_id-element_name = 'BATCH_ID'.
    ls_id-element_value = 'BATCH001'.
    APPEND ls_id TO it_id.
    CALL FUNCTION '/AIN/UI_MOBILE_MSG_SEND'
      IN BACKGROUND TASK
      DESTINATION  'RFC_UPDATEAII'
      EXPORTING
        IV_BUSINESS_PROCESS       = '09'
        IV_COMMAND                = 'DO'
        IV_ACTION_TYPE            = 'APL2'
        IV_PRT_ID                 = '31140242200000000F000000'
        IV_DEVGRP_EXTID           = 'MOBILE'
      TABLES
        IT_ID                     = it_id
      commit work.
    And the parsed RFC-XML message is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <rfc:_-AIN_-UI_MOBILE_MSG_SEND
    xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    <IV_ACTION_TYPE>APL2</IV_ACTION_TYPE>
    <IV_BTD_EXTID />
    <IV_BTD_TYPE />
    <IV_BUSINESS_PROCESS>09</IV_BUSINESS_PROCESS>
    <IV_COMMAND>DO</IV_COMMAND>
    <IV_DEVGRP_EXTID>MOBILE</IV_DEVGRP_EXTID>
    <IV_LOC_EXTID />
    <IV_LOC_TYPE />
    <IV_PRT_ID>31140242200000000F000000</IV_PRT_ID>
    <IV_PRT_ID_VERSION />
    <IV_REASON_CODE />
    <IV_UNAME/>
    <ET_RETURN />
    <IT_ID>
    <item>
    <ID_VERSION>EPC_1.30</ID_VERSION>
    <ID>206DC3C00000000A BATCH_ID</ID>
    <ELEMENT_NAME />
    <ELEMENT_VALUE />
    </item>
    </IT_ID>
    </rfc:_-AIN_-UI_MOBILE_MSG_SEND>
    You can see the data in the table is all wrong, it should be:
    <IT_ID>
    <item>
    <ID_VERSION>EPC_1.30</ID_VERSION>
    <ID>30340242206DC3C00000000A</ID>
    <ELEMENT_NAME>BATCH_ID</ELEMENT_NAME>
    <ELEMENT_VALUE>BATCH001</ELEMENT_VALUE>
    </item>
    </IT_ID>
    The calling system is a 4.6C non-unicode system, and the destination system is a unicode system (this does not matter since the first part of the integration is between R3 and XI). There is no config found on R3 side to specify non-unicode because it is a rather old system. In XI RFC Adapter config, I checked non-unicode checkbox (I also tested it with this unchecked, but still the same issue).
    Have any of you seen this problem and how you resolve it?
    Thanks a lot for your help!
    Regards,
    Hart

    Hi Hart
    long time no seen - hope you remember me
    >The reason to use two RFC adapter and BPM is to log the request message if the RFC call fails
    there is an easy way (guess max 3-4 hours) to solve all of your issues
    and get rid of a BPM
    use IDOC - XI - ABAP Proxy
    then you will have IDOC and ABAP Proxy that always log the message on both ends (and you can restart ABAP proxies easily in AII - and every AII supports ABAP proxies) + you get rid of a BPM as it's not necessary as far as I understand (as it's asyn communication right?)
    maybe you can go this way and IDOCs always work...
    good luck,
    Regards,
    Michal Krawczyk
    http://mypigenie.com XI/PI FAQ

  • XML file parse issue

    I have a requirement to print <attribute-override> and <column> in a spreadsheet.
    My xml file is as
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd">
      <entity class="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetails">
        <table name="FLX_AC_ACCT_CREDIT_MATRIX_DTLS"/>
        <attributes>
          <embedded-id attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetricDetailsKey" name="key">
            <attribute-override name="accountId">
              <column name="ACCOUNT_ID"/>
            </attribute-override>
            <attribute-override name="accountType">
              <column name="ACCOUNT_TYPE"/>
            </attribute-override>
            <attribute-override name="effectiveDate">
              <column name="EFFECTIVE_DATE"/>
            </attribute-override>
            <attribute-override name="matrixIdvalue">
              <column name="MATRIX_ID_VALUE"/>
            </attribute-override>
            <attribute-override name="classification">
              <column name="Classification"/>
            </attribute-override>
          </embedded-id>
          <embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.CreditMetric" name="creditMetric">
            <attribute-override name="metricType">
              <column name="METRIC_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="metricValue">
              <column name="METRIC_VALUE" unique="false"/>
            </attribute-override>
          </embedded>
          <embedded attribute-type="com.ofss.fc.domain.account.entity.accountcreditmatrix.RiskScore" name="riskScore">
            <attribute-override name="scoreType">
              <column name="SCORE_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="otherScoreType">
              <column name="OTHER_SCORE_TYPE" unique="false"/>
            </attribute-override>
            <attribute-override name="scoreCardExternalReferenceNo">
              <column name="SCORE_EXTR_REF_NO" unique="false"/>
            </attribute-override>
            <attribute-override name="ratingModel">
              <column name="RATING_MODEL" unique="false"/>
            </attribute-override>
            <attribute-override name="ratingStatus">
              <column name="RATING_STATUS" unique="false"/>
            </attribute-override>
            <attribute-override name="riskGrade">
              <column name="RISK_GRADE" unique="false"/>
            </attribute-override>
            <attribute-override name="scoreCardIndex">
              <column name="SCORE_CARD_INDEX" unique="false"/>
            </attribute-override>
            <attribute-override name="score">
              <column name="SCORE" unique="false"/>
            </attribute-override>
          </embedded>
        </attributes>
      </entity>
    </entity-mappings>
    I have managed to write the code as
    package xmlexcel;
    import org.apache.poi.hssf.usermodel.*;
    import java.util.ArrayList;
    import java.awt.List;
    import java.io.*;
    import java.util.ArrayList;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class XMLconvertExcel {
      private static File xmlDocument;
        private static NodeList e;
        int a;
      public void generateExcel(File xmlDocument) {
      try {
      HSSFWorkbook wb = new HSSFWorkbook();
      HSSFSheet spreadSheet = wb.createSheet("spreadSheet");
      spreadSheet.setColumnWidth((short)0,(short) (256*25));
      spreadSheet.setColumnWidth((short)1,(short) (256*25));
      spreadSheet.setColumnWidth((short)2,(short) (256*25));
      spreadSheet.setColumnWidth((short)3,(short) (256*25));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document document = builder.parse(xmlDocument);
      NodeList nList = document.getElementsByTagName("attributes");
      document.getDocumentElement().normalize();
      //a=nodelist.getLength();
      //e = printStackTrace();
      //System.out.println("I am here " +e);
             System.out.println("Root element :" + document.getDocumentElement().getNodeName() + " nlist length  " +nList.getLength());
             System.out.println("Node Type :" + document.getDocumentElement().getNodeType());
      HSSFRow row = spreadSheet.createRow(0);
      HSSFCell cell = row.createCell((short)0);
      cell.setCellValue("Entity");
      cell = row.createCell((short)1);
      cell.setCellValue("Table");
      cell = row.createCell((short)2);
      cell.setCellValue("Attribute");
      cell = row.createCell((short)3);
      cell.setCellValue("Column");
      HSSFRow row1 = spreadSheet.createRow(1);
      HSSFRow row2 = spreadSheet.createRow(2);
      HSSFRow row3 = spreadSheet.createRow(3);
      for (int i = 0; i < nList.getLength(); i++) {
      Node nNode = nList.item(i);
                 System.out.println("\nCurrent Element :"    + nNode.getNodeName());
                 switch {
      case 0:
      //cell = row1.createCell((short)0);
      //cell.setCellValue("Attribute");
      //trying from http://architects.dzone.com/articles/parsing-xml-using-dom-sax-and
      cell = row1.createCell((short) 2);
                    cell.setCellValue(((Element) (nList.item(0)))
                       .getElementsByTagName("attribute-override").item(0)
                       .getFirstChild().getNodeValue());
      break;
      case 1:
      //cell = row1.createCell((short)1);
      //cell.setCellValue("Table");
      cell = row1.createCell((short) 3);
      cell.setCellValue(((Element) (nList.item(0)))
      .getElementsByTagName("column").item(0)
      .getFirstChild().getNodeValue());
      break;
      case 2:
      cell = row1.createCell((short)2);
      cell.setCellValue("Attribute");
      cell = row1.createCell((short) 2);
      cell.setCellValue(((Element) (nodelist.item(2)))
      .getElementsByTagName("attribute-override").item(0)
      .getFirstChild().getNodeValue());
      cell = row1.createCell((short)3);
      cell.setCellValue("Column");
      cell = row1.createCell((short) 3);
      cell.setCellValue(((Element) (nodelist.item(3)))
      .getElementsByTagName("column").item(0)
      .getFirstChild().getNodeValue());
      break;
      default:
      break;
      //wb.write(arg1.getOutputPayload().getOutputStream());
      //Outputting to Excel spreadsheet
      FileOutputStream output = new FileOutputStream(new File("C:\\java_training\\com\\XMLtoExcel\\ormaccount.xls"));
             wb.write(output);
             output.flush();
             output.close();
      } catch (IOException e) {
      System.out.println("IOException " + e.getMessage());
      } catch (ParserConfigurationException e) {
      System.out.println("ParserConfigurationException " +e.getMessage());
      }catch (SAXException e) {
      System.out.println("SAXException " +e.getMessage());
      private String printStackTrace() {
      // TODO Auto-generated method stub
      return null;
      * @param args
      public static void main(String[] args) {
      File xmlDocument = new File("C:\\java_training\\com\\XMLtoExcel\\AccountCreditMatrixDetails.orm.xml");
      XMLconvertExcel excel = new XMLconvertExcel();
      excel.generateExcel(xmlDocument);
    Both the tags are not getting printed in separate columns.
    I have looked at
    http://www.javaworld.com/article/2076189/enterprise-java/book-excerpt--converting-xml-to-spreadsheet--and-vice-versa.html
    http://scn.sap.com/thread/3224533
    http://www.tutorialspoint.com/java_xml/java_dom_parse_document.htm
    The above URL shows example of simple xml.
    Please can I get assistance.

    I too received this error as I tried to run my first Windows 8.1 deployment. Per another post I commented out this line
    <IEWelcomeMsg>false</IEWelcomeMsg>
    from the IE section of the unattend.xml. I was then able to run my deployment. I do not see this line in your posting though.
    I referenced this link even though it was for Windows 7.
    http://social.technet.microsoft.com/Forums/en-US/c41a2b69-a591-4cd3-86ab-6a0f8a73b858/getting-windows-could-not-parse-or-process-the-unattend-answer-file-for-pass-specialize-with?forum=mdt
    Hope this helps someone.
    JayTheTech
    To clarify, I edited the unattend.xml file from from Deployment Share, not C:\Windows\Panther.
    DS\control\task sequence ID\unattend.xml
    JayTheTech

  • Xml document parse Exception

    Hi,
    when i am parsing the document having encoding scheme is US-ASCII
    doc = docBuilder.parse(url);     
    it throws Exception :
    com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Byte "146" is not a member of the (7-bit) ASCII character set.
    how can i resolve it ?

    Read url and convert the String to bytes using UTF-8, which is the default character encoding for XML.

  • XML "Document" tag issue

    In my data xml file, I get data like this:
    <?xml version='1.0' encoding='UTF-8'?>
    <Document xmlns='urn:iso:std:iso:20022:tech:xsd:pain.002.001.02' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    In Document tag, because of this: xmlns='urn:iso:std:iso:20022:tech:xsd:pain.002.001.02', the rtf doesn't show any output. But if I manually go data xml file and remove xmlns='urn:iso:std:iso:20022:tech:xsd:pain.002.001.02', then my data xml file will be like this:
    <?xml version='1.0' encoding='UTF-8'?>
    <Document xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
    This perfectly works for me. For testing purpose, I removed it (*xmlns='urn:iso:std:iso:20022:tech:xsd:pain.002.001.02'*). As the data file is from external source, I can't control always. Can someone pls help on this?
    Thanks,
    Mani

    I also have problem with 'Document' tag:
    My xsl is like :
    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- $Header: XXMCK_FINLAND_SEPA_EFT_R51-58.xsl 2011/08/4 12:43:27 $ -->
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="no" />
    <xsl:output method="xml"/>
    <xsl:key name="contacts-by-LogicalGroupReference" match="OutboundPayment" use="PaymentNumber/LogicalGroupReference" />
    <xsl:template match="OutboundPaymentInstruction">
    <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02 pain.001.001.02.xsd">
              <pain.001.001.02>
    Here in Document tag 2 lines are there, but in xml output these lines get reversed as shown below:
    <Document xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02 C:\XMLSPY~1\pain.001.001.02.xsd" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    Can anybody plz help in this regard?

  • Altova XML Spy parsing issue

    I wonder if anyone can help.
    Pasted below is an standard WSDL file has generated by BPEL Designer. However, XML Spy wont validate it, reporting:
    "The file is not valid. Unexpected element 'plnk:PartnerLinkType' in element definitions"
    Can anyone help?
    many thanks
    Vince
    <?xml version="1.0"?>
    <definitions name="a"
    targetNamespace="http://www.a.com"
    xmlns:tns="http://www.a.com"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    >
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TYPE DEFINITION - List of types participating in this BPEL process
    The BPEL Designer will generate default request and response types
    but you can define or import any XML Schema type and use them as part
    of the message types.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <types>
    <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
    targetNamespace="http://www.a.com"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="aRequest">
    <complexType>
    <sequence>
    <element name="input" type="string"/>
    </sequence>
    </complexType>
    </element>
    <element name="aResponse">
    <complexType>
    <sequence>
    <element name="result" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    </types>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MESSAGE TYPE DEFINITION - Definition of the message types used as
    part of the port type defintions
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <message name="aRequestMessage">
    <part name="payload" element="tns:aRequest"/>
    </message>
    <message name="aResponseMessage">
    <part name="payload" element="tns:aResponse"/>
    </message>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PORT TYPE DEFINITION - A port type groups a set of operations into
    a logical service unit.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- portType implemented by the a BPEL process -->
    <portType name="a">
    <operation name="process">
    <input message="tns:aRequestMessage" />
    <output message="tns:aResponseMessage"/>
    </operation>
    </portType>
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PARTNER LINK TYPE DEFINITION
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <plnk:partnerLinkType name="a">
    <plnk:role name="aProvider">
    <plnk:portType name="tns:a"/>
    </plnk:role>
    </plnk:partnerLinkType>
    </definitions>

    Alexander,
    There is a WSDL tutorial in User Manual of Altova XML Spy Help. Just go through that which gives you an idea of how to generate the WSDL file.
    Also go through this weblogs which may give some information:
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    /people/siva.maranani/blog/2005/03/01/testing-xi-exposed-web-services
    ---Satish

  • XMLDocument and blank XML tag parse issue

    var xmlDoc:XMLDocument = new XMLDocument();
                    xmlDoc.ignoreWhite = false;
                    xmlDoc.parseXML("<Test> </Test>");
                    var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
                    var processObj:Object = decoder.decodeXML(xmlDoc);
                   trace( processObj.Test  );
    Result is comming as 0 instead of a blank space between the tags(<Test> </Test>).

    Hi,
    Here are two possible solutions :
    xmlelement("EXCEPTIONS",
      xmlforest(
        xmlforest(
          v1.exception_code as "EXCEPTION_CODE"
        , v1.exception_long_desc as "EXCEPTION_LONG_DESC"
        ) as "EXCEPTION"
    )or,
    xmlelement("EXCEPTIONS",
      case when v1.exception_code is not null
             or v1.exception_long_desc is not null
        then xmlelement("EXCEPTION",
               xmlforest(
                 v1.exception_code as "EXCEPTION_CODE"
               , v1.exception_long_desc as "EXCEPTION_LONG_DESC"
      end
    )

  • Issue with parsing an xml document and namespaces

    I am having an issue when parsing an xml document that includes a namespace.
    Here is my xml:
    <?xml version="1.0" encoding="utf-8"?>
    <StatusFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TxCnt="247" TxTotal="5756845.31" SourceId="3" xmlns="http://www.test.com/cig/payments/optimizer/status/2004/10/">
    <Tx PmtId="350031" Amt="16739" TxSts="09" CustSts="04" ChkNum="10605770" />
    <Tx PmtId="350990" Amt="31698.66" TxSts="09" CustSts="04" ChkNum="10605821" />
    <Tx PmtId="354992" Amt="201320.08" TxSts="09" CustSts="04" />
    <Tx PmtId="349277" Amt="6675.17" TxSts="09" CustSts="04" ChkNum="10605822" />
    <Tx PmtId="354979" Amt="66949.75" TxSts="09" CustSts="04" ChkNum="10605823" />
    <Tx PmtId="349341" Amt="63258.49" TxSts="09" CustSts="04" ChkNum="10605824" />
    <Tx PmtId="350025" Amt="5866.04" TxSts="09" CustSts="04" ChkNum="10605830" />
    <Tx PmtId="350024" Amt="15671.8" TxSts="09" CustSts="04" ChkNum="10605831" />
    <Tx PmtId="346822" Amt="9880.64" TxSts="09" CustSts="04" />
    <Tx PmtId="350023" Amt="1360" TxSts="09" CustSts="04" />
    <Tx PmtId="349802" Amt="131267" TxSts="09" CustSts="04" ChkNum="10605832" />
    <Tx PmtId="343573" Amt="14532.76" TxSts="09" CustSts="04" ChkNum="10605833" />
    <Tx PmtId="352675" Amt="4436" TxSts="09" CustSts="04" />
    <Tx PmtId="350022" Amt="1260" TxSts="09" CustSts="04" ChkNum="10605834" />
    <Tx PmtId="349714" Amt="80778" TxSts="09" CustSts="04" ChkNum="10605835" />
    <Tx PmtId="352676" Amt="10136" TxSts="09" CustSts="04" ChkNum="10605836" />
    <Tx PmtId="352679" Amt="25511.69" TxSts="09" CustSts="04" ChkNum="10605837" />
    <Tx PmtId="346502" Amt="12842.69" TxSts="10" CustSts="05" />
    <Tx PmtId="346503" Amt="4232.61" TxSts="09" CustSts="04" ChkNum="10605838" />
    </StatusFile>
    Here is my current code base:
    CREATE OR REPLACE PROCEDURE ParseXML(xml VARCHAR2) IS
    myParser xmlparser.parser := xmlparser.newparser;
    myDoc xmldom.DOMNode;
    myNodes xmldom.DOMNodeList;
    myElement xmldom.DOMElement;
    trec NDE_CIG_STATUS_TRANSACTIONS%ROWTYPE;
    BEGIN
    xmlparser.parseBuffer(myParser,xml);
    myDoc := xmldom.makeNode(xmlparser.getDocument(myParser));
    myNodes := xslprocessor.selectNodes(myDoc,'//Tx');
    FOR i IN 0..xmldom.getLength(myNodes)-1 LOOP
    myElement := xmldom.makeElement(xmldom.item(buyOrders,i));
    trec.pmt_id := xmldom.getAttribute(curBuy,'PmtId');
    INSERT INTO NDE_CIG_STATUS_TRANSACTIONS(PMT_ID) VALUES (trec.pmt_id);
    END LOOP;
    COMMIT;
    END ParseXML;
    If I remove the namespace, everything works just fine. The issue is that I cannot remove the namespace.
    Anyone have any suggestions on how I can get the xslprocessor.selectNodes to recognize my namespace?
    Thanks,
    Mark Moran

    Everyone,
    Well after lots of hours spent reading web pages and blogs, etc... I was able to re-write my procedure and get it to work with different calls.
    Here is my updated code.
    PROCEDURE PARSE_STATUS_XML(P_FILE_NAME IN VARCHAR2, P_XML_FILE IN CLOB) IS
    V_PARSER XMLPARSER.PARSER := XMLPARSER.NEWPARSER;
    V_DOCUMENT XMLDOM.DOMDOCUMENT;
    V_NODES XMLDOM.DOMNODELIST;
    V_ELEMENT XMLDOM.DOMELEMENT;
    V_TBL_RECORD NDE_CIG_STATUS_TRANSACTIONS%ROWTYPE;
    BEGIN
    XMLPARSER.PARSECLOB(V_PARSER, P_XML_FILE);
    V_DOCUMENT := XMLPARSER.GETDOCUMENT(V_PARSER);
    V_ELEMENT := XMLDOM.GETDOCUMENTELEMENT(V_DOCUMENT);
    V_NODES := XMLDOM.GETELEMENTSBYTAGNAME(V_ELEMENT,'Tx','http://www.test.com/cig/payments/optimizer/status/2004/10/');
    FOR I IN 0..XMLDOM.GETLENGTH(V_NODES)-1 LOOP
    V_ELEMENT := XMLDOM.MAKEELEMENT(XMLDOM.ITEM(V_NODES,I));
    V_TBL_RECORD.PMT_ID := XMLDOM.GETATTRIBUTE(V_ELEMENT,'PmtId');
    V_TBL_RECORD.PMT_AMT := XMLDOM.GETATTRIBUTE(V_ELEMENT,'Amt');
    V_TBL_RECORD.E_STATUS_CODE := XMLDOM.GETATTRIBUTE(V_ELEMENT,'TxSts');
    V_TBL_RECORD.E_REASON_CODE := XMLDOM.GETATTRIBUTE(V_ELEMENT,'StsRsn');
    V_TBL_RECORD.E_CUSTOMER_STATUS_CODE := XMLDOM.GETATTRIBUTE(V_ELEMENT,'CustSts');
    V_TBL_RECORD.UPS_TRACKING_NBR := XMLDOM.GETATTRIBUTE(V_ELEMENT,'UpsTrcNum');
    V_TBL_RECORD.FED_REFERENCE_NBR := XMLDOM.GETATTRIBUTE(V_ELEMENT,'FedRefNum');
    V_TBL_RECORD.FIDB_TRACKING_NBR := XMLDOM.GETATTRIBUTE(V_ELEMENT,'FIDbtTrcNum');
    V_TBL_RECORD.CHECK_NBR := XMLDOM.GETATTRIBUTE(V_ELEMENT,'ChkNum');
    INSERT INTO NDE_CIG_STATUS_TRANSACTIONS(
    CREATE_DATE,
    XML_FILE_NAME,     
    PMT_ID,
    PMT_AMT,
    E_STATUS_CODE,
    E_REASON_CODE,
    E_CUSTOMER_STATUS_CODE,
    UPS_TRACKING_NBR,
    FED_REFERENCE_NBR,
    FIDB_TRACKING_NBR,
    CHECK_NBR
         VALUES (
    SYSDATE,
    P_FILE_NAME,
    V_TBL_RECORD.PMT_ID,
    V_TBL_RECORD.PMT_AMT,
    V_TBL_RECORD.E_STATUS_CODE,
    V_TBL_RECORD.E_REASON_CODE,
    V_TBL_RECORD.E_CUSTOMER_STATUS_CODE,
    V_TBL_RECORD.UPS_TRACKING_NBR,
    V_TBL_RECORD.FED_REFERENCE_NBR,
    V_TBL_RECORD.FIDB_TRACKING_NBR,
    V_TBL_RECORD.CHECK_NBR
    END LOOP;
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
         RAISE;
    END PARSE_STATUS_XML;
    Mark

  • Error:SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. --- There is an error in XML document (1, 447). --- Input string was not in a correct format.

    Hi All,
        We have a scenario of FTP-->PI---> Webservice.  While triggering the data in the FTP, it is failing in the PI with the below error
    SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 447). ---> Input string was not in a correct format.
    Can you please help?

    Hi Raja- It seems to be a data quality issue.
    Check for the value @ 1447 position in the xml message that you are trying to send to web service..
    may be a date filed/decimal value which is not in expected format.

  • ? is shown for Norwegian characters when XML document is parsed using DOM

    Hi,
    I've a sample program that creates a XML document with a single element book having Norwegian characters. Encoding is UTF-8. When i parse the XML document and try to access the value of that element then ? are shown for Norwegian characters. XML document file name is "Sample.xml"
                DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
                DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
                Document doc = docBuilder.newDocument();
                Element root = doc.createElement("root");
                root.setAttribute("value", "Á á &#260; &#261; ä É é &#280;");
                doc.appendChild(root);
                TransformerFactory transfac = TransformerFactory.newInstance();
                Transformer trans = transfac.newTransformer();
                trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
                trans.setOutputProperty(OutputKeys.INDENT, "yes");
                trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
                //create string from xml tree
                java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
                StreamResult result = new StreamResult(baos);
                DOMSource source = new DOMSource(doc);
                trans.transform(source, result);
                writeToFile("Sample.xml", baos.toByteArray());
                InputSource is = new InputSource(new java.io.ByteArrayInputStream(readFile("Sample.xml")));
                is.setEncoding("UTF-8");
                DocumentBuilder obj_db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document obj_doc = obj_db.parse(is);
                obj_doc.normalize();
                System.out.println("Value is : " + new String(((Element) obj_doc.getElementsByTagName("root").item(0)).getAttribute("value").getBytes()));writeFile() - Writes the document bytes in Sample.xml file
    readFile() - Reads the Sample.xml file
    When i run this program XML editor shows the characters correctly but Java code output is: Á á ? ? ä É é ?
    What's the problematic area in my java code. I didn't get any help from any source. Please suggest me the solution of this problem.
    Thanx in advance.

    Hi,
    I'm using JBuilder 2005 and i mentioned encoding UTF-8 for saving Java source files and also for compilation. I've modified my source code also. But the problem persists. After applying changing the dumped sample.xml file doesn't display these characters correctly in IE, but earlier it was displaying it correctly at IE.
    Modified code is:
    DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
                DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
                Document doc = docBuilder.newDocument();
                Element root = doc.createElement("root");
                root.setAttribute("value", "Á á &#260; &#261; ä É é &#280;");
                doc.appendChild(root);
                OutputFormat output = new OutputFormat(doc, "UTF-8", true);
                java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
                OutputStreamWriter osw = new OutputStreamWriter(baos, "UTF-8");
                XMLSerializer s = new XMLSerializer(osw, output);
                s.asDOMSerializer();
                s.serialize(doc);
                writeToFile("Sample5.xml", baos.toByteArray());
                InputSource o = new InputSource(new java.io.ByteArrayInputStream(readFile("Sample5.xml")));
                o.setEncoding("UTF-8");
                com.sun.org.apache.xerces.internal.parsers.DOMParser obj_parser = new com.sun.org.apache.xerces.internal.parsers.DOMParser();
                obj_parser.parse(o);
                Document obj_doc = obj_parser.getDocument();
                System.out.println("Value : " + new String(((Element) obj_doc.getElementsByTagName("root").item(0)).getAttribute("value").getBytes()));I'm hanged on this issue. Can u please provide me the code snippet that works with these characters or suggest solution.
    Thanx

  • XML Parse issues when using Network Data Model LOD with Springframework 3

    Hello,
    I am having issues with using using NDM in conjuction with Spring 3. The problem is that there is a dependency on the ConfigManager class in that it has to use Oracle's xml parser from xmlparserv2.jar, and this parser seems to have a history of problems with parsing Spring schemas.
    My setup is as follows:
    Spring Version: 3.0.1
    Oracle: 11GR2 and corresponding spatial libraries
    Note that when using the xerces parser, there is no issue here. It only while using Oracle's specific parser which appears to be hard-coded into the ConfigManager. Spring fortunately offers a workaround, where I can force it to use a specific parser when loading the spring configuration as follows:
    -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl But this is an extra deployment task we'd rather not have. Note that this issue has been brought up before in relation to OC4J. See the following link:
    How to change the defaut xmlparser on OC4J Standalone 10.1.3.4 for Spring 3
    My question is, is there any other way to configure LOD where it won't have the dependency on the oracle parser?
    Also, fyi, here is the exception that is occurring as well as the header for my spring file.
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
    Line 11 in XML document from URL [file:/C:/projects/lrs_network_domain/service/target/classes/META-INF/spring.xml] is invalid;
    nested exception is oracle.xml.parser.schema.XSDException: Duplicated definition for: 'identifiedType'
         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
         [snip]
         ... 31 more
    Caused by: oracle.xml.parser.schema.XSDException: Duplicated definition for: 'identifiedType'
         at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:425)
         at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:287)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:331)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:222)
         at oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:155)
         at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)Here is my the header for my spring configuration file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">Thanks, Tom

    I ran into this exact issue while trying to get hibernate and spring working with an oracle XMLType column, and found a better solution than to use JVM arguments as you mentioned.
    Why is it happening?
    The xmlparserv2.jar uses the JAR Services API (Service Provider Mechanism) to change the default javax.xml classes used for the SAXParserFactory, DocumentBuilderFactory and TransformerFactory.
    How did it happen?
    The javax.xml.parsers.FactoryFinder looks for custom implementations by checking for, in this order, environment variables, %JAVA_HOME%/lib/jaxp.properties, then for config files under META-INF/services on the classpath, before using the default implementations included with the JDK (com.sun.org.*).
    Inside xmlparserv2.jar exists a META-INF/services directory, which the javax.xml.parsers.FactoryFinder class picks up and uses:
    META-INF/services/javax.xml.parsers.DocumentBuilderFactory (which defines oracle.xml.jaxp.JXDocumentBuilderFactory as the default)
    META-INF/services/javax.xml.parsers.SAXParserFactory (which defines oracle.xml.jaxp.JXSAXParserFactory as the default)
    META-INF/services/javax.xml.transform.TransformerFactory (which defines oracle.xml.jaxp.JXSAXTransformerFactory as the default)
    Solution?
    Switch all 3 back, otherwise you'll see weird errors.  javax.xml.parsers.* fix the visible errors, while the javax.xml.transform.* fixes more subtle XML parsing (in my case, with apache commons configuration reading/writing).
    QUICK SOLUTION to solve the application server startup errors:
    JVM Arguments (not great)
    To override the changes made by xmlparserv2.jar, add the following JVM properties to your application server startup arguments.  The java.xml.parsers.FactoryFinder logic will check environment variables first.
    -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
    However, if you run test cases using @RunWith(SpringJUnit4ClassRunner.class) or similar, you will still experience the error.
    BETTER SOLUTION to the application server startup errors AND test case errors:
    Option 1: Use JVM arguments for the app server and @BeforeClass statements for your test cases.
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory","com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
    System.setProperty("javax.xml.parsers.SAXParserFactory","com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
    System.setProperty("javax.xml.transform.TransformerFactory","com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
    If you have a lot of test cases, this becomes painful.
    Option 2: Create your own Service Provider definition files in the compile/runtime classpath for your project, which will override those included in xmlparserv2.jar.
    In a maven spring project, override the xmlparserv2.jar settings by creating the following files in the %PROJECT_HOME%/src/main/resources directory:
    %PROJECT_HOME%/src/main/resources/META-INF/services/javax.xml.parsers.DocumentBuilderFactory (which defines com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl as the default)
    %PROJECT_HOME%/src/main/resources/META-INF/services/javax.xml.parsers.SAXParserFactory (which defines com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl as the default)
    %PROJECT_HOME%/src/main/resources/META-INF/services/javax.xml.transform.TransformerFactory (which defines com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl as the default)
    These files are referenced by both the application server (no JVM arguments required), and solves any unit test issues without requiring any code changes.
    This is a snippet of my longer solution for how to get hibernate and spring to work with an oracle XMLType column, found on stackoverflow.

  • Need help in Parsing XML Document in Oracle

    Hello Experts,
    I urgently need your help. We have xml document on the Web but not on the File System. How can I parse the xml document on the web in Oracle.
    Any link, blog or sample code would be appreciated.
    Your help would be appreciated.
    Kind Regards,
    Bhavin
    London, UK

    This breaks down to two issues
    1) Getting the XML into Oracle
    2) Parsing the XML inside Oracle
    For #1, the first two options that come to my mind are httpuirtype and utl_http. Both can be used to get information from a URL that understands HTTP requests.
    For #2, you can treat the XML as a DOMDocument or XMLType to parse it. You also could parse it via a SQL statement using XQuery or XMLTable as well.
    Many of those examples can be found on the {forum:id=34} forum or [Marco&apos;s blog|http://www.liberidu.com/blog/]. A few parsing examples that I've done can be seen at {message:id=3610259}, make sure to also follow the link I put in there to a previous example before that.

Maybe you are looking for