Problem in the Parsing (XML to DOM)

Hi all , In our scenario we are trying to create a DOM tree from a XML file  but we are getting the error in the following statement 
l_rc = if_iparser->parse( ).
when we track the error using
  i = l_error->get_line( ).           (result 0)
  i = l_error->get_column( ).     (result 2017)
  str = l_error->get_reason( ).   (Expected '<' or '/>' tag)
but strange thing is we can open the file using Stylus studio/ Altova / IE ..so may the problem is not in the XML file ....Has anybody faced the problem before ??
Kind regarrds
Goutam

Data error

Similar Messages

  • Problem in parsing XML using DOM Parser.

    Hi,
    I am parsing an XML using DOM Parser.
    When i try to get attributes of a node, i dont get in the order it is written. For Eg. This the node:
    <Level0 label="News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="202" uid="COGN-4MNMT3" parentid="aaaa">
    When i try to print the attribute values i should get in the order:
    News, /website/ing_news.nsf/ViewNewsForm?OpenForm&All, 202, COGN-4MNMT3, aaaa
    BUT I AM GETTING IN THE ORDER:
    News, 202, /website/ing_news.nsf/ViewNewsForm?OpenForm&All, aaaa, COGN-4MNMT3
    Is there any way to sort this problem out?
    Thanks and Regards,
    Ashok

    Hi Guys,
    Thanks a lot for your replies.
    But i want to keep all the values as attributes only.
    the XML file is as shown below:
    <Menu>
    <Level0 label="News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="202" uid="COGN-4MNMT3" parentid="aaaa" children="3">
         <Level1 label="ING News" link="" level="1" uid="COGN-4MNN89" parentid="COGN-4MNMT3" children="3" >
              <Level2 label="All ING News" link="/website/ing_news.nsf/ViewNewsForm?OpenForm&All" level="2" uid="INGD-4MVTK2" parentid="COGN-4MNN89" children="0">
              </Level2>
    </Level1>
    </Level0>
    The code i was using to get attributes is:
    String strElementName = new String(node.getNodeName());
         // System.out.println("strElementName:"+node.getNodeName());
    NamedNodeMap attrs = node.getAttributes();
    if (attrs != null) {
    int iLength = attrs.getLength();
    for (int i = 0; i < iLength; i++) {
    String strAttributes = (String) attrs.item(i).getNodeName();
    String strValues = (String) attrs.item(i).getNodeValue();
    Also is it not possible to Enforce the order using some Schema/DTD in this case?
    TIA
    Ashok

  • Parsing xml using DOM parser in java

    hi there!!!
    i don have much idea about parsing xml.. i have an xml file which consists of details regarding indentation and spacing standards of C lang.. i need to read the file using DOM parser in java n store each of the attributes n elements in some data structure in java..
    need help as soon as possible!!!

    DOM is the easiest way to parse XML document, google for JDOM example it is very easy to implement.
    you need to know what is attribute, what is text content and what is Value in XML then easily you can parse your document with dom (watch for space[text#] in your XML document when you parse it).
    you get root node then nodelist of childs for root then go further inside, it is easy believe me.

  • Problem with the processing of my DOM tree

    hello,
    here a small part of the XML document that i have to process....
    <questestinterop>
    *<item title="Capital of France" ident="I01" maxattempts="6">
    <qticomment>
    This Item is the first example to be used in the QTI XML Binding Base Document.
    </qticomment>
    <itemmetadata/>
    **<presentation label="Resp001">
    <response_lid ident="LID01">
    <material>
    <mattext>What is the Capital of France ?</mattext>
    </material>
    <render_choice shuffle="Yes">
    <response_label ident="LID01_A">
    <material>
    <mattext>London</mattext>
    </material>
    </response_label>
    I can access to the attribute of the "item" tag (marked with * symbol),by creating a node as follow: (item is a childnode of questestinterop, my root tag)
    Node root = document.getLastChild();
                   Node node = root.getFirstChild();
                   while (!node.getNodeName().equals("item")){                    
                        node =node.getNextSibling();
    then i process on this node to get the attributes of my "item" tag...
    but after i want to access to the "presentation" (marked with ** symbol)tag that is a ChildNode of my previous node by using
    node = node.getFirstChild();
    (in fact as I do in the parentNode)
    but then my node type is TEXT and I dont understand. then i m not able to process it as the previous one. I was expecting it to be a DOCUMENT_NODE!!
    I want to be able to go deeper in the tree because I need to extract data from there.     
    (I was thinking of going deeper by taking each time i needed it the childnode of my existing node then do a while loop to access to the needed tag.)
    Maybe i am taking the problem on a wrong way.
    Can someone give me some hints or tips, i m really stuck.          
    thank you
    francois

    i ve found my mistake,
    dont crack ur head for me
    merci
    francois

  • I  have some more problem in the  web.xml file and url-pattern in my  syste

    HI ALL!
    How can I create and place the web.xml and URL-parrten.Because I run
    the tomcat in my computer with ME system.
    Hoc

    what is the problem? please be more specific and detailed? check a sample web.xml file and make your own one and place it in your <application-context>\WEB-INF folder..

  • Problem with the config.xml

    Dear all,
    After doing a wscompile on the config.xml file (JWSDP1.6), I am able to generate the wsdl for the interface defined.
    But now the config.xml shows an error
    "Cannot find the declaration of element 'configuration' "
    for the attribute xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"
    Any idea what is the problem as "http://java.sun.com/xml/ns/jax-rpc/ri/config" is no longer available on the sun site.
    Any alternate references to be made to this xml namespace declaration.
    Rgds,
    Seetesh

    My point above is that Project 2007 was extremely buggy and unless files are saved using Project 2007 SP3 first you are likely to experience problems with the files when opening in project 2010. Project 2007 to 2010 with no service packs is problematic.
    With SPs applied you should have far fewer problems.
    Doesn't look like a exe with SP2 is available yet so you need to add the service pack separately, probably in the updates folder.
    If all Project 2007 installs are already at SP3 then no need for this.
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Problem in parsing XML using DOM

    I am getting one XML file as string like <?xml version="1.0" encoding="ISO-8859-1" ?> <DMSI-ACTIVITY-COMMENTS> </DMSI-ACTIVITY-COMMENTS>
    Every time I want to add new node <ACTIVITY>
              <NAME></NAME>
              <ID></ID>
              <COMMENT></COMMENT>
         </ACTIVITY> whenever user make any change in my application.
    I wrote code....
    InputStream inputStream = new ByteArrayInputStream(file.getBytes());
    Document doc = docBuilder.parse(inputStream);
    Element activityNode = doc.createElement("ACTIVITY");
    Element nameNode = doc.createElement("NAME");
    activityNode.appendChild(nameNode);
    Text nametextNode = doc.createTextNode(name);
    nameNode.appendChild(nametextNode);
    Element root = doc.getDocumentElement();
    root.appendChild(activityNode);
    String resultUDA = doc.toString();
    Problem: Here I am getting value of resultUDA is [#document: null]. I need updated XML as String....
    any one can give me suggestion or any other option to solve this issue...
    thanks in advance...

    I got it ....pls check on it
    http://www.theserverside.com/discussions/thread.tss?thread_id=26060

  • Problem occurs when parsing uri into dom.

    Hey guys, I got problem when I tries to parse a rss feed url to dom.
    It works fine with most xml urls. However, e.g, "http://digg.com/rss/index.xml" doesnt work at all. It gives java.net.SocketException (connection reset). So I reckson it even could not open the connection to that url.
    Not sure about how it works and if its a rss feed server's issue.
    Some code as below:
    Document document = null;
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();     
              try {
                   DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse(uri);
              } catch (SAXException sxe) {.................} catch...............
    thank you for any help in advance.
    Cheers,
    Lin

    This problem has nothing to do with parsing. I used a URLConnection object to get access to the input stream provided by the URL "http://digg.com/rss/index.xml". After hanging for 378 seconds I got the following error when the getInputStream() method was invoked on the URLConnection object:java.net.SocketException: Unexpected end of file from server
            at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:684)
            at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
            at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:682)
            at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:939)
    ...The error message reveals that the error occurs after the http connection has been opened. The problem is that the input stream is not appropriate even for interpreting as a file content, let alone parsing it as an XML document. Nowhere have I found a clear-cut answer to this problem which makes me think this error might be caused by a bug. You should try posting here:
    http://forum.java.sun.com/forum.jspa?forumID=536

  • What's the problem in the this XML?

    Hi!!
    I changed only first line cleo.xml
    It is used DOMSample(XML parser for C v2)
    <?xml version="1.0" encoding="iso-8859-1"?>
    In line 1 of cleo.xml:
    LPX-00201: Message 201 not found; No message file for product=ORACORE, facility=LPX
    Parse failed, error 201
    What's the plblem?

    I have a similar header on my XML files.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    I am not sure, but suspect that your line is missing the space between the quote and question mark. The only difference from my lines is that I always use ISO in upper case.
    Good luck.

  • Prefix problem in the Output XML

    Hi,
    I am working on iIdoc to file scenario.
    For the Target file structure I have created XSD as it contains a prefix wmb in every field. But when I test , I cud see the prefix as ns0 in MONI. How do I replace the Prefix ns0 with WMB
    I think the probable solutions could be using XSLT Mapping or use XMLAnonymizerBean Module
    Any Inputs would be appreciated.
    Regards,
    Varun

    Hi Varun,
    > For the Target file structure I have created XSD as it contains a prefix wmb in every field. But when I test , I cud see the prefix as ns0 in MONI.  How do I replace the Prefix ns0 with WMB
    No need to create external XSD, follow the standard process. XMLAnonymizerBean provides an easy solution.
    Use the following settings at Receiver communication channel
    Module tab
    Module Name : AF_Modules/XMLAnonymizerBean
    Type :Local Enterprise Bean
    Module Key
    Module Configuration
    1. Module Key : 0
    Parameter Name : anonymizer.acceptNamespaces
    Parameter Key : <interface> WMB
    2. Module Key : 0
    Parameter Name : anonymizer.quote
    Parameter Key : '
    Regards,
    Sunil Chandra

  • How to read xml-stylesheet Processing Instruction from XML using DOM Parser

    Hi,
    I am trying to read an xml that contains xsl stylesheet PI using DOMParser. The parse() method reads the entire contents of the XML except the PI instruction. Below is the XML I am using to read
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet href="../../../lang/en-us/style0/usc_profile.xsl" type="text/xsl"?>
    <Oblix oblang="en-us" xmlns="http://www.oblix.com/" xmlns:oblix="http://www.oblix.com/">
    <ObProfile>
    </ObProfile>
    </Oblix>
    Can anyone let me know if there are any propery settings to be done for the DOM parser before parsing?. If so, what is the property to be set?.
    Thanks in Advance
    Muthu

    A COTS product builds the XML and inserts the respective xsl (xml:stylesheet) file name to be used for transforming the xml. I am trying to interrupt this xml and make some updations on an element and finally send the updated xml to the stream.
    For the above process, I parse the input XML using DOMParser and update the elements (some internal elements). While I view the final XML that would be passed to the stream, I found the <?xml-stylesheet... PI is missing.
    I somehow managed using a temp fix by doing the below. I manually pulled the PI using document.getFirstChild().getNodeValue() and reconstructed the PI and inserted it to the outgoing XML. This needs to be done every time. This might run into problems when more than one PI is used in the XML.
    If the parsed XML could get the PI along with it the above problem could be resolved.
    Is there any property that could be set on the parser (prior to parsing) to resolve the issue?.

  • How do you store parsed XML data in an array

    Hi, i am trying to complete a small program which implements the SAX parser to parse an XML file. My problem is that i am writing a custom class to store the parsed data into an array, and then make the array available to the main program via a simple method which returns the array. I know this must be very simple to do, but i seem to have developed a mental block with this part of the program. I can parse the data and print all the elements to the screen, but i just cant figure out how to store all the data elements into the array. I will post the class which is supposed to do this, and ask anyone out there if they know what i'm doing wrong, and also, if there is a more effeicient way of achieving this ( i expect there definitely is!! but i have never used the SAX parser before and am getting confused by the API docs on it!!) Any help very much appreciated.
    Here is my attempt at coding the class to handle the parsed XML data
    class Sink extends org.xml.sax.helpers.DefaultHandler
         implements org.xml.sax.ContentHandler{
    Customer[] customers = new Customer[20];
         int count = 1;
         int x = 0;
         int tagCount = 0;
         String name;
    String custID;
         String username;
         String address;
         String phoneNum;
    public void startElement(String uri, String localName, String rawName, final org.xml.sax.Attributes attributes)throws org.xml.sax.SAXException{
    //count the number of <name> tags in the XML file
         if(rawName.equals("name")){
              tagCount++;
    public void characters(char[] ch, int start, int len){
    //get the current string
         String text = new String(ch, start, len);
         String text1 = text.trim();
    //there are 5 elements for each customer found in the XML file so when the count reaches 6
    // i reset this to 1
         if(count == 6){
         count = count - 5;
         if(text1.length()>0 && count == 1){
              name = text1;
              System.out.println(name);
              }else{
         if(text1.length()>0 && count == 2){
              custID = text1;
              System.out.println(custID);
                   }else{
                   if(text1.length()>0 && count == 3){
                   username = text1;
                   System.out.println(username);
                   }else{
                        if(text1.length()>0 && count == 4){
                        address = text1;
                        System.out.println(address);
                        }else{
                        if(text1.length()>0 && count == 5){
                             phoneNum = text1;
                             System.out.println(phoneNum);
                             //add data to the customer array
                             customers[x] = new Customer(name, custID, username, address, phoneNum);
    // increment the array index counter
                        x = x+1;
                        }//end of if
                        }//end else
                        }//end else
                   }//end else
              }//end else
    }//end of characters method
    public void endDocument(){
         System.out.println("There are " + tagCount +
         " <name> elements.");
    }//end of class Sink
    Before the end of this class i also need to make the array available to the calling program!!
    Any help would be much appreciated
    Thanks
    Iain

    Ok, yer going about this all the wrong way. You shouldn't have to maintain a count of all the elements. Basically you are locking yourself into the XML tags not only all being there but are assuming they are all in the same order. What you should do is in your characters() method, put all of the characters into a string buffer. Then, in endElement() (which you dont use btw, you should) you grab the information that is in the string buffer and store it into your Customer object depending on what the tagName is.
    Also, you should probably use a List to store all the Customer objects and not an single array, it's more dynamic and you arent locked into a set number of Customers.
    I wont do it all for you, but I'll give you a good outline to use.
    public class CustomerHandler extends DefaultHandler {
        private java.util.List customerList;  // List of Customer objects
        private java.util.StringBuffer buf;   // StringBuffer to store the string of characters between the start and end tags
        private Customer customer;  // Customer object that is initialized with each entry.
        public CustomerHandler() {
            customerList = new java.util.ArrayList();   // Initialize the List
            buf = new java.util.StringBuffer();   // Initialize the string buffer
        //  Make your customer list available to other classes
        public java.util.List getCustomerList() {
            return customerList;
        public void startElement(String nsURI, String sName, String tagName, Attributes attributes) throws SAXException {
            // Clear the String Buffer
            //  If the tagName is "Customer" then create a new Customer object
        public void characters(char[] ch, int start, int length) {
            //  append the characters into the string buffer
        public void endElement(String nsURI, String sName, String tagName) throws SAXException {
            // If the tagName is "Customer" add your customer object to the List
            // Place the data from the String Buffer into a String
            //  Depending on the tagName, call the appropriate set method on your customer object
    }

  • Possible to overwrite parse method in DOM with SAX Handler?

    Hi,
    Is it possible to overwrite the parse method within DOM?
    What a want to do is:
         private Node parseXml( String text ) throws SAXParseException, SAXException, IOException, ParserConfigurationException
              SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setNamespaceAware(true);
                   SAXParser parser = factory.newSAXParser();
                   TestHandler handler = new TestHandler();
                   // Parse the file
                   parser.parse(new InputSource(new StringReader(text)), handler);
              return (Node)handler.getRoot();
         } //end parseXml()The reason I want to use this is that within SAX I can write my own line counter so I keep a count of which node is on which line of text.
    What I was thinking is that I could use SAX to return DOM Nodes with the line number attached, possibly using the node.setUserData() method?!
    I have tried to play around with it and it doen't seem to work, can anyone help?
    Cheers Alex

    I have managaed to re-write my SAX parser to create a JTree, this works perfectly I can move through the tree and each line of text that corresponds to the node is highlighted.
    My problem is however that in my application I have used the DOM structure throughout so some of the functionality is lost.
    Is I understand that JAXP uses both SAX and DOM together, so I was wondering if it is possible to combine my sax parse method within the DOM?
    If anything is unclear please say and I will try and explain better. The main reason for doing this is that I want to keep a reference to which line of text each node of the dom tree represents. I have not been able to implemnet one in DOM however using SAX I have managed.
    Many thanks,
    Alex

  • Problem with SimpleDateFormat.parse()

    Hello
    I have a problem with the parse-function in SimpleDateFormat.
    When i try to parse the date Fri Jul 15 17:23:41 2005 with this pattern EEE MMM d HH:mm:ss yyyy i get the exception java.text.ParseException: Unparseable date: "Fri Jul 15 17:23:41 2005".
    This is my code:
    SimpleDateFormat df=new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
    try {
      df.parse(strDate);
    } catch (ParseException e) {
      e.printStackTrace();
    }Can someone explain me what i did wrong?
    Thanks
    Matthias

    Since your name is "Matthias" it is possible that your locale is one that does not use the English language. If that is the case then your problem is that "Fri" or "Jul" are not correct abbreviations in your language.
    Easiest way to test this idea is to format a date (such as now) using that SimpleDateFormat object and see what the output looks like.

  • Contribute CS3 Client breaks the server XML

    Well, I have found an interesting problem with the cthub XML
    file that is stored in the "_mm" directory in the root folder of
    your websites being administered by Contribute.
    As you are no doubt aware, when at least one admin upgrades
    to Contribute 4 or Contribute CS3 (aka 4.1) all the admins have to
    since there are upgrades made to the XML files that control the
    site. Well it appears that this upgrade makes the cthub file
    non-valid XML.
    Take a look at this file and look for the tag "font_use_css"
    inside the "group_list_item" child node of the "group_list" node.
    In a copy of the cthub file that was upgraded you will find that
    this standalone tag is missing the appropriate closing slash. If
    you compare this against a copy of the cthub file from before the
    upgrade, assuming you made a backup, you will find that the tag is
    properly closed.
    Since this file is the master file with all of the role
    information for the site, I wonder if this XML error is causing
    unknown instability in the system somewhere.

    I'm having the very same issue. Very frustrating. Support had me uninstall and reinstall. That did not wor
    k, Then they had me uninstall and reinstall as a trial. That did not work. Very umimpressed with Adobe
    products and support.
    Anyone have a solution to this issue. I'm at the end of my rope.

Maybe you are looking for

  • How to get data from the called program using SUBMIT in a background job?

    Hi Experts, I've a program which creates a background job using JOB_OPEN and JOB_CLOSE function modules. Between the above function modules I need to call a program using SUBMIT VIA JOB statement. My problem is, How do I fetch some data in an interna

  • Issue with Vendor BP in SUS

    Hi All, We are on SRM 4.0 with   EBP _ SUS scanario. We  flagged one vendor as portal vendor.  That vendor is  transferred to SUS  but without  BP number created. When we are assignhing contact persons  using transciation USERS_GEN system is giving e

  • Oracle Database 11g Backup Deduplication using CommVault

    Hi Everyone We have recently implemented Commvault solution for a Backup and Recovery of Oracle database and other IT softwares / fileservers. Oracle E-business suite 12.1.1 is implemented in our organization with 11g database 11.2.0.3.6, for all the

  • Customer consignment stock table-field

    HI All, Please let me know which is the correct field of MSKU which gives me CUSTOMER Consignment stock. Thanks, Saravanan

  • Do I get an Universal Dock Adapter for the iPod nano 7. gen?

    I allready have the universal dock connector, but with the new Lightning Connector it is not working. I can't imagine to connect the new iPod nano with the Lightning to 30-pin Adapter?! Will the iPod fit the universal dock with it? Anyone with some e