Problems whilst Parsing XML with KXML2

I have been doing a lot of reading up on the APIs of XMLPull and KXML2.
I seem to be facing a problem which can't be solved just by reading but rather the expertise of the more experienced programmers dealing with XML parsing in J2ME.
I know how long it takes to process an entire XML document, I just would like to parse certain parts of the document. For e.g. instead of reading the whole document, say I just want to read the first 7 items and subsequently, the next 7 items when the user clicks on the next page?
In other words, I wish to incorporate paging. Is it possible? Or if you have an alternative solution which will not make a user wait too long, please share it!
Can anyone help me?

I don't think that is possible. We can't make the XML
any smaller because it contains all the information I
want to display. Just that I want to display it in
pages/sections so as to reduce the load.
So I was thinking of whether it is possible to read
the first 5 <title> tags and next 5 for every page
... etcimagine that you have 20 pages so the user will have to download a 20 x 5 items xml file?
if the user stops the navigation at page 4, he will download 16 pages for nothing so that's
why i told you to separate the results...
an xml file for each page and not a huge for all !

Similar Messages

  • Problem parsing XML with schema when extracted from a jar file

    I am having a problem parsing XML with a schema, both of which are extracted from a jar file. I am using using ZipFile to get InputStream objects for the appropriate ZipEntry objects in the jar file. My XML is encrypted so I decrypt it to a temporary file. I am then attempting to parse the temporary file with the schema using DocumentBuilder.parse.
    I get the following exception:
    org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element '<root element name>'
    This was all working OK before I jarred everything (i.e. when I was using standalone files, rather than InputStreams retrieved from a jar).
    I have output the retrieved XML to a file and compared it with my original source and they are identical.
    I am baffled because the nature of the exception suggests that the schema has been read and parsed correctly but the XML file is not parsing against the schema.
    Any suggestions?
    The code is as follows:
      public void open(File input) throws IOException, CSLXMLException {
        InputStream schema = ZipFileHandler.getResourceAsStream("<jar file name>", "<schema resource name>");
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = null;
        try {
          factory.setNamespaceAware(true);
          factory.setValidating(true);
          factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
          factory.setAttribute(JAXP_SCHEMA_SOURCE, schema);
          builder = factory.newDocumentBuilder();
          builder.setErrorHandler(new CSLXMLParseHandler());
        } catch (Exception builderException) {
          throw new CSLXMLException("Error setting up SAX: " + builderException.toString());
        Document document = null;
        try {
          document = builder.parse(input);
        } catch (SAXException parseException) {
          throw new CSLXMLException(parseException.toString());
        }

    I was originally using getSystemResource, which worked fine until I jarred the application. The problem appears to be that resources returned from a jar file cannot be used in the same way as resources returned directly from the file system. You have to use the ZipFile class (or its JarFile subclass) to locate the ZipEntry in the jar file and then use ZipFile.getInputStream(ZipEntry) to convert this to an InputStream. I have seen example code where an InputStream is used for the JAXP_SCHEMA_SOURCE attribute but, for some reason, this did not work with the InputStream returned by ZipFile.getInputStream. Like you, I have also seen examples that use a URL but they appear to be URL's that point to a file not URL's that point to an entry in a jar file.
    Maybe there is another way around this but writing to a file works and I set use File.deleteOnExit() to ensure things are tidied afterwards.

  • Problem while creating xml with cdata section

    Hi,
    I am facing problem while creating xml with cdata section in it. I am using Oracle 10.1.0.4.0 I am writing a stored procedure which accepts a set of input parameters and creates a xml document from them. The code snippet is as follows:
    select xmlelement("DOCUMENTS",
    xmlagg
    (xmlelement
    ("DOCUMENT",
    xmlforest
    (m.document_name_txt as "DOCUMENT_NAME_TXT",
    m.document_type_cd as "DOCUMENT_TYPE_CD",
    '<![cdata[' || m.document_clob_data || ']]>' as "DOCUMENT_CLOB_DATA"
    ) from table(cast(msg_clob_data_arr as DOCUMENT_CLOB_TBL))m;
    msg_clob_data_arr is an input parameter to procedure and DOCUMENT_CLOB_TBL is a pl/sql table of an object containing 3 attributes: first 2 being varchar2 and the 3rd one as CLOB. The xml document this query is generating is as follows:
    <DOCUMENTS>
    <DOCUMENT>
    <DOCUMENT_NAME_TXT>TestName</DOCUMENT_NAME_TXT>
    <DOCUMENT_TYPE_CD>BLOB</DOCUMENT_TYPE_CD>
    <DOCUMENT_CLOB_DATA>
    &lt;![cdata[123456789012345678901234567890123456789012]]&gt;
    </DOCUMENT_CLOB_DATA>
    </DOCUMENT>
    </DOCUMENTS>
    The problem is instead of <![cdata[....]]> xmlforest query is encoding everything to give &lt; for cdata tag. How can I overcome this? Please help.

    SQL> create or replace function XMLCDATA_10103 (elementName varchar2,
      2                                             cdataValue varchar2)
      3  return xmltype deterministic
      4  as
      5  begin
      6     return xmltype('<' || elementName || '><![CDATA[' || cdataValue || ']]>
      7  end;
      8  /
    Function created.
    SQL>  select xmlelement
      2         (
      3            "Row",
      4            xmlcdata_10103('Junk','&<>!%$#&%*&$'),
      5            xmlcdata_10103('Name',ENAME),
      6            xmlelement("EMPID", EMPNO)
      7         ).extract('/*')
      8* from emp
    SQL> /
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[SMITH]]></Name>
      <EMPID>7369</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[ALLEN]]></Name>
      <EMPID>7499</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[WARD]]></Name>
      <EMPID>7521</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[JONES]]></Name>
      <EMPID>7566</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[MARTIN]]></Name>
      <EMPID>7654</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[BLAKE]]></Name>
      <EMPID>7698</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[CLARK]]></Name>
      <EMPID>7782</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[SCOTT]]></Name>
      <EMPID>7788</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[KING]]></Name>
      <EMPID>7839</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[TURNER]]></Name>
      <EMPID>7844</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[ADAMS]]></Name>
      <EMPID>7876</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[JAMES]]></Name>
      <EMPID>7900</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[FORD]]></Name>
      <EMPID>7902</EMPID>
    </Row>
    <Row>
      <Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
      <Name><![CDATA[MILLER]]></Name>
      <EMPID>7934</EMPID>
    </Row>
    14 rows selected.
    SQL>

  • Problem while using XML with Oracle

    I have a problem using XML with oracle applications
    The process I am following
    1. Making a XML string.
    2. Parsing it to get a document
    3. Free the parser using xmlparser.freeparser
    4. Traversing through nodes .
    5. Freeing the document.
    The whole Process is executed in batch mode.
    The problem occurs after executing the procedure for 5000 records and I get the error
    ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
    heap","library cache")
    Can you please help me out to overcome this problem
    It's urgent
    I have
    Oracle version 8.1.7.0.0
    XML version 1.2
    OS Windows NT
    To resolve the problem I have increase shared memory size and java initialization parameters ,which seems OK
    Looking forward for your answer.

    Hello, Reena
    Your process flow seems to be correct in term of getting/freeing memory.
    Following error
    The problem occurs after executing the procedure for 5000 records and I get the error
    ORA-04031: unable to allocate 4176 bytes of shared memory ("shared pool","unknown object","sga
    heap","library cache")may be caused by memory leaks in xdk or memory fragmentation(due to get/free memory cycle)
    To find out if this is an memory leak issue you could try to monitor V$SGASTAT from one session while running your batch process in another session.
    To prevent (or lower its impact) fragmentation issues try to PIN objects, and adjust java_pool_size and shared_pool_reserved_size.
    Anyway, counsult your Oracle DBA.
    Oracle version 8.1.7.0.0I think, you should apply database patch first of all. The latest one (8.1.7.4.x) could be accured from Metalink.

  • Persisting unexplained errors when parsing XML with schema validation

    Hi,
    I am trying to parse an XML file including XML schema validation. When I validate my .xml and .xsd in NetBeans 5.5 beta, I get not error. When I parse my XML in Java, I systematically get the following errors no matter what I try:
    i) Document root element "SQL_STATEMENT_LIST", must match DOCTYPE root "null".
    ii) Document is invalid: no grammar found.
    The code I use is the following:
    try {
    Document document;
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse( new File(PathToXml) );
    My XML is:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <!-- Defining the SQL_STATEMENT_LIST element -->
    <xs:element name="SQL_STATEMENT_LIST" type= "SQL_STATEMENT_ITEM"/>
    <xs:complexType name="SQL_STATEMENT_ITEM">
    <xs:sequence>
    <xs:element name="SQL_SCRIPT" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <!-- Defining simple type ApplicationType with 3 possible values -->
    <xs:simpleType name="ApplicationType">
    <xs:restriction base="xs:string">
    <xs:enumeration value="DawningStreams"/>
    <xs:enumeration value="BaseResilience"/>
    <xs:enumeration value="BackBone"/>
    </xs:restriction>
    </xs:simpleType>
    <!-- Defining the SQL_SCRIPT element -->
    <xs:element name="SQL_SCRIPT" type= "SQL_STATEMENT"/>
    <xs:complexType name="SQL_STATEMENT">
    <xs:sequence>
    <xs:element name="NAME" type="xs:string"/>
    <xs:element name="TYPE" type="xs:string"/>
    <xs:element name="APPLICATION" type="ApplicationType"/>
    <xs:element name="SCRIPT" type="xs:string"/>
    <!-- Making sure the following element can occurs any number of times -->
    <xs:element name="FOLLOWS" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    and my XML is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    Document : SQLStatements.xml
    Created on : 1 juillet 2006, 15:08
    Author : J�r�me Verstrynge
    Description:
    Purpose of the document follows.
    -->
    <SQL_STATEMENT_LIST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.dawningstreams.com/XML-Schemas/SQLStatements.xsd">
    <SQL_SCRIPT>
    <NAME>CREATE_PEERS_TABLE</NAME>
    <TYPE>CREATION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    CREATE CACHED TABLE PEERS (
    PEER_ID           VARCHAR(20) NOT NULL,
    PEER_KNOWN_AS      VARCHAR(30) DEFAULT ' ' ,
    PRIMARY KEY ( PEER_ID )
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>CREATE_COMMUNITIES_TABLE</NAME>
    <TYPE>CREATION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    CREATE CACHED TABLE COMMUNITIES (
    COMMUNITY_ID VARCHAR(20) NOT NULL,
    COMMUNITY_KNOWN_AS VARCHAR(25) DEFAULT ' ',
    PRIMARY KEY ( COMMUNITY_ID )
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>CREATE_COMMUNITY_MEMBERS_TABLE</NAME>
    <TYPE>CREATION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    CREATE CACHED TABLE COMMUNITY_MEMBERS (
    COMMUNITY_ID VARCHAR(20) NOT NULL,
    PEER_ID VARCHAR(20) NOT NULL,
    PRIMARY KEY ( COMMUNITY_ID, PEER_ID )
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>DROP_PEER_TABLE</NAME>
    <TYPE>DELETION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    DROP TABLE PEERS IF EXISTS
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>DROP_COMMUNITIES_TABLE</NAME>
    <TYPE>DELETION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    DROP TABLE COMMUNITIES IF EXISTS
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>DROP_COMMUNITY_MEMBERS_TABLE</NAME>
    <TYPE>DELETION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    DROP TABLE COMMUNITY_MEMBERS IF EXISTS
    </SCRIPT>
    </SQL_SCRIPT>
    <SQL_SCRIPT>
    <NAME>CREATE_COMMUNITY_MEMBERS_VIEW</NAME>
    <TYPE>CREATION</TYPE>
    <APPLICATION>DawningStreams</APPLICATION>
    <SCRIPT>
    CREATE VIEW COMMUNITY_MEMBERS_VW AS
    SELECT P.PEER_ID, P.PEER_KNOWN_AS, C.COMMUNITY_ID, C.COMMUNITY_KNOWN_AS
    FROM PEERS P, COMMUNITIES C, COMMUNITY_MEMBERS CM
    WHERE P.PEER_ID = CM.PEER_ID
    AND C.COMMUNITY_ID = CM.COMMUNITY_ID
    </SCRIPT>
    <FOLLOWS>CREATE_PEERS_TABLE</FOLLOWS>
    <FOLLOWS>CREATE_COMMUNITIES_TABLE</FOLLOWS>
    </SQL_SCRIPT>
    </SQL_STATEMENT_LIST>
    Any ideas? Thanks !!!
    J�r�me Verstrynge

    Hi,
    I found the solution in the following post:
    Validate xml with DOM - no grammar found
    Sep 17, 2003 10:58 AM
    The solution is to add a line of code when parsing:
    try {
    Document document;
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse( new File(PathToXml) );
    The errors are gone !!!
    J�r�me Verstrynge

  • Problem in parsing XML Schema

    I am trying to parse XML Schema using XSOM. The Schema has <xs:include>s
    e.g. I have first.xsd which includes second.xsd and second.xsd again includes third.xsd.
    First.xsd
    <xs:include schemaLocation="../Second.xsd">....
    Second.xsd
    <xs:include schemaLocation="Third.xsd">....
    When I parse "First.xsd" parser passes the correct path "C:/XSDSchema/Second.xsd"(First.xsd resides in "C:/XSDSchema/Schema/") to the EntityResolver's resolveEntity method. But for Second.xsd it passes "Third.xsd" only (Third.xsd resides in "C:/XSDSchema/" ) .
    Any Idea ?????

    Here is a screenshort of the part of my workflow:
    In the mappings of the "Set Value" activity, I have one line with those properties:
    Location: /process_data/bonusValidationForm/object/data/xdp/datasets/data/BonusValidationForm/buMan agerID
    Expression: /process_data/currentUser/object/@userId
    Where:
    bonusValidationForm is a process variable of my workflow that point my xdp form
    buManagerID is the textfield I want to set
    currentUser is a process variable (type User) that was well setted by the task Find BU Manager

  • How to Parse XML with SAX and Retrieving the Information?

    Hiya!
    I have written this code in one of my classes:
    /**Parse XML File**/
              SAXParserFactory factory = SAXParserFactory.newInstance();
              GameContentHandler gameCH = new GameContentHandler();
              try
                   SAXParser saxParser = factory.newSAXParser();
                   saxParser.parse(recentFiles[0], gameCH);
              catch(javax.xml.parsers.ParserConfigurationException e)
                   e.printStackTrace();
              catch(java.io.IOException e)
                   e.printStackTrace();
              catch(org.xml.sax.SAXException e)
                   e.printStackTrace();
              /**Parse XML File**/
              games = gameCH.getGames();And here is the content handler:
    import java.util.ArrayList;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    class GameContentHandler extends DefaultHandler
         private ArrayList<Game> games = new ArrayList<Game>();
         public void startDocument()
              System.out.println("Start document.");
         public void endDocument()
              System.out.println("End document.");
         public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes atts) throws SAXException
         public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
         public void characters(char[] ch, int start, int length) throws SAXException
              /**for (int i = start; i < start+length; i++)
                   System.out.print(ch);
         public ArrayList<Game> getGames()
              return games;
    }And here is the xml i am trying to parse:<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
    <Database>
         <Name></Name>
         <Description></Description>
         <CurrentGameID></CurrentGameID>
         <Game>
              <gameID></gameID>
              <name></name>
              <publisher></publisher>
              <platform></platform>
              <type></type>
              <subtype></subtype>
              <genre></genre>
              <serial></serial>
              <prodReg></prodReg>
              <expantionFor></expantionFor>
              <relYear></relYear>
              <expantion></expantion>
              <picPath></picPath>
              <notes></notes>
              <discType></discType>
              <owner></owner>
              <location></location>
              <borrower></borrower>
              <numDiscs></numDiscs>
              <discSize></discSize>
              <locFrom></locFrom>
              <locTo></locTo>
              <onLoan></onLoan>
              <borrowed></borrowed>
              <manual></manual>
              <update></update>
              <mods></mods>
              <guide></guide>
              <walkthrough></walkthrough>
              <cheats></cheats>
              <savegame></savegame>
              <completed></completed>
         </Game>
    </Database>I have been trying for ages and just can't get the content handler class to extract a gameID and instantiate a Game to add to my ArrayList! How do I extract the information from my file?
    I have tried so many things in the startElement() method that I can't actually remember what I've tried and what I haven't! If you need to know, the Game class instantiates with asnew Game(int gameID)and the rest of the variables are public.
    Please help someone...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    OK, how's this?
    public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes atts) throws SAXException
              current = "";
         public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
              try
                   if(qualifiedName.equals("Game") || qualifiedName.equals("Database"))
                        {return;}
                   else if(qualifiedName.equals("gameID"))
                        {games.add(new Game(Integer.parseInt(current)));}
                   else if(qualifiedName.equals("name"))
                        {games.get(games.size()-1).name = current;}
                   else if(qualifiedName.equals("publisher"))
                        {games.get(games.size()-1).publisher = current;}
                   etc...
                   else
                        {System.out.println("ERROR - Qualified Name found in xml that does not exist as databse field: " + qualifiedName);}
              catch (Exception e) {} //Ignore
         public void characters(char[] ch, int start, int length) throws SAXException
              current += new String(ch, start, length);
         }

  • XI Soap Adapter: problems in parsing XML

    Hallo,
    I call a Web Service using XMLSpy and this is the response (note tag <File>):
              <SOAPSDK4:ExpBaselineResponse xmlns:SOAPSDK4="http://tempuri.org/PRWBS_PRIMAVERA/message/">
                   <RESULT>OK</RESULT>
                   <File>&lt;?xml version=&apos;1.0&apos; encoding=&apos;UTF-8&apos;?&gt;
    &lt;Dati:Parametri xmlns:Dati=&quot;Schema&quot;&gt;
         &lt;ELSAG xmlns=&quot;Schema&quot;&gt;
              &lt;proj_id&gt;4623&lt;/proj_id&gt;
              &lt;BS_short_name&gt;FS0084AAAA01 - B1&lt;/BS_short_name&gt;
              &lt;BS_proj_id&gt;1302&lt;/BS_proj_id&gt;
              &lt;TARGET_START&gt;2004-04-01&lt;/TARGET_START&gt;
    ....etc...
    If I call the same Web Service from XI, this is the response:
    <SOAPSDK4:ExpBaselineResponse xmlns:SOAPSDK4="http://tempuri.org/PRWBS_PRIMAVERA/message/" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema">
         <RESULT>OK</RESULT>
         <File>&#60;?xml version="1.0" standalone="yes"?&#62;
    &#60;Dati:Parametri xmlns:Dati="Schema"&#62;
         &#60;ELSAG xmlns="Schema"&#62;
              &#60;proj_id&#62;4623&#60;/proj_id&#62;
              &#60;BS_short_name&#62;FS0084AAAA01 - B1&#60;/BS_short_name&#62;
              &#60;BS_proj_id&#62;1302&#60;/BS_proj_id&#62;
              &#60;TARGET_START&#62;2004-04-01&#60;/TARGET_START&#62;
    ....etc....
    In my flow, I use a java mapping to parse the content of tag <File> into a message.
    My mapping works correctly only with the first option.
    Is it possible to change XI Soap Adapter encoding for HTML?
    My java mapping uses this parser:
         public void execute(InputStream MyInputStream, OutputStream MyOutputStream)
                   throws StreamTransformationException {
              SAXReader reader = new SAXReader();
              Document document;
              try {
                   document = reader.read(MyInputStream);
    this instruction generates an Exception only with XI message.
    Can anybody help me??
    Thanks;-)

    Hi,
    I would suggest you go through this Pdf for the SOAP Adapter configuration:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/40728f7b-0401-0010-d9bc-8c73884a3789
    And also have a glance on the info for webservices given below,
    Just go through these links and they will surely help you learn more about Webservices:
    <a href="/people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi Webservices using SAPXI</a>
    <a href="/people/siva.maranani/blog/2005/05/23/communication-between-sap-system-webservice-using-proxies between SAP System & Webservice Using Proxies</a>
    You can Go through these links to get some info about accessing Webservices:
    http://help.sap.com/saphelp_nw04/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/b7/d7baaf1481a349ab723e3acd7334b3/content.htm
    Go through these links which will surely help you find an answer to your problem.....
    Regards,
    Abhy

  • Parsing XML with VBS at a Windows Server 2008 R2

    Hi
    my name is Marius, and I have a little problem with my vbs script. I use this script to parse an xml File if there are errors inside. In my old environment Windows Server 2003 it would work fine.
    Now I will run this script at a newer Server 2008 R2, and it is not working.
    Dim sName
    sName = "Path to xml file"
    Dim xmlFile
    Dim oneNode
    Dim childNodes, childNode
    Dim attribut
    Dim EventID
    Dim repGroup
    Dim CustomDomain
    Dim ErrorCounter
    BackupNotes = ""
    ErrorCounter = 0
    wscript.Echo "sName: " & sName 'Wird in die Logdatei geschrieben
    set xmlFile = CreateObject("Microsoft.XMLDOM")
    'Es wird die XML Datei geladen
    if xmlFile.load(sName) then
    'Schreibt das Datum und die Uhrzeit des XML Datei in oneNode
    set oneNode = xmlFile.selectSingleNode("//timestamp/systemTime")
    if oneNode is Nothing then
    BackupBeginTime = ""
    BackupEndTime = ""
    BackupBeginDate = ""
    BackupEndDate = ""
    'wscript.echo "Keine Daten vorhanden" 'Wird in die Logdatei geschrieben
    else
    'Friday, November 09, 2012 11:55:32
    BackupBeginTime = right(oneNode.text, 8)
    'nimm von rechts die 8 folgenden Zeichen (11:55:32)
    BackupEndTime = BackupBeginTime
    Dim Laenge
    Laenge = LEN(oneNode.text)
    'zaehlt die Lange des Strings in oneNode 'Friday, November 09, 2012 11:55:32 = 34
    'wscript.echo Laenge
    Laenge = Laenge - 9
    '34 - 9 = 25
    'es wird das Datum aus dem String der XML Datei gebaut, damit es in die DB geschrieben werden kann
    Dim dfsDate
    Dim dfsVon
    Dim dfsBis
    dfsDate = left(oneNode.text, Laenge)
    'nimm von links die 25 folgenden Zeichen (Friday, November 09, 2012)
    dfsVon = inStr(dfsDate, ",")
    'pruefe wo das 1. Komma ist und schreiben die Zeichen in die Variable
    dfsVon = dfsVon + 1
    'wscript.echo dfsVon
    dfsBis = LEN(dfsDate)
    'wscript.echo dfsBis
    dfsDate = mid(dfsDate, dfsVon, dfsBis)
    'Nimm die daten ab dem Komme bis zum Ende des Strings
    dfsDate = trim(dfsDate)
    'entferne die Leerzeichen Vor und Nach dem Sting
    'Wscript.echo dfsDate
    dfsDate = cdate(dfsDate)
    'dfsDate = November 09, 2012 und wird in 09.11.2012 durch cdate umgebaut
    'wscript.echo dfsDate
    BackupBeginDate = dfsDate
    BackupEndDate = dfsDate
    end if
    set oneNode = xmlFile.selectSingleNode("//replicationGroup")
    'Sucht nach der Replikationsgruppe und der Domain
    repGroup = oneNode.getAttribute("name")
    CustomDomain = oneNode.getAttribute("domain")
    if oneNode is Nothing then
    wscript.echo "Keine Daten vorhanden"
    'Wird in die Logdatei geschrieben
    else
    wscript.echo "RepGroup: " & repGroup
    'holt sich den Namen der Replikations Gruppe 'Wird in die Logdatei geschrieben
    wscript.echo "Domain: " & CustomDomain
    'holt sich den Domain 'Wird in die Logdatei geschrieben
    end if
    set childNodes = xmlFile.selectNodes("//serverErrors/error")
    for each childNode in childNodes
    'Zugriff auf den Type und die Event ID
    attribut = childNode.getAttribute("type")
    EventID = childNode.getAttribute("id")
    if isNull(attribut) then
    wscript.echo "MultiParameter nicht gefunden" 'Wird in die Logdatei geschrieben
    'Fehlerhandling, da attribut nicht vorhanden
    'wenn keines dieser Attribute vorhanden ist, ist der Backupjob erfolgreich
    ErrorCounter = 0
    else
    ' pruefen was im attribut steht und dann entscheiden ob erfolgreich oder nicht
    if(attribut = "error") then
    if(EventID = "6002") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &")"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - http://support.microsoft.com/kb/953527" 'Wird in die Logdatei geschrieben
                   'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
                    ErrorCounter = ErrorCounter + 1
    elseif(EventID = "11004") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Temp File)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Es konnten nicht alle Daten kopiert werden, Temporaere Dateien http://social.technet.microsoft.com/wiki/contents/articles/406.dfsr-does-not-replicate-temporary-files.aspx"
    'Wird in die Logdatei geschrieben
                   'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
                    ErrorCounter = ErrorCounter + 0
    elseif(EventID = "4302") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Freigabeverletzung)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Freigabeverletzung http://support.microsoft.com/kb/973836 - Fehler ist bekannt und kann ignoriert werden" 'Wird in die
    Logdatei geschrieben
                   'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
                    ErrorCounter = ErrorCounter + 0
    elseif(EventID = "4208") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Staging Quota)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Staging Quota zu klein http://blogs.technet.com/b/askds/archive/2011/07/13/how-to-determine-the-minimum-staging-area-dfsr-needs-for-a-replicated-folder.aspx"
    'Wird in die Logdatei geschrieben
                   'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
                    ErrorCounter = ErrorCounter + 1
    else
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &")"
    wscript.echo "EventID: "& attribut &" ("& EventID & ")"  'Wird in die Logdatei geschrieben
                   'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
                    ErrorCounter = ErrorCounter + 1
    end if
    end if
    if(attribut = "warning") then
    if (EventID = "4208") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Staging Quota)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Staging Quota zu klein http://www.retherfords.com/blogs/CoryRetherford/Lists/Posts/Post.aspx?ID=104 - Fehler ist bekannt und
    kann ignoriert werden"  'Wird in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    elseif (EventID = "11004") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Temp Datei)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Es konnten nicht alle Daten kopiert werden, Temporaere Dateien - Fehler ist bekannt und kann ignoriert werden"  'Wird
    in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    elseif (EventID = "4302") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Freigabeverletzung)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Freigabeverletzung http://support.microsoft.com/kb/973836 - Fehler ist bekannt und kann ignoriert werden"  'Wird
    in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    elseif (EventID = "4206") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" - Staging Quota)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - Staging Quota zu klein http://mpwiki.viacode.com/default.aspx?g=posts&t=123818"  'Wird in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    elseif (EventID = "11001") then
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &" -)"
    wscript.echo "EventID: "& attribut &" ("& EventID & ") - "  'Wird in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    else
    BackupNotes = BackupNotes & " "& attribut &"("& EventID &")"
    wscript.echo "EventID: "& attribut &" ("& EventID & ")"  'Wird in die Logdatei geschrieben
    'Fehlerbehandlung mit ErrrorCounter - Fehler bekannt = 0 Fehler unbekannt + 1
    ErrorCounter = ErrorCounter + 0
    end if
    end if
    end if
    next
    else
    wscript.echo "Pfad (sName): XML Datei nicht vorhanden" 'Wird in die Logdatei geschrieben
    ErrorCounter = ErrorCounter + 1
    'Wenn keine XML Datei vorhanden ist, wird dies in die DB geschrieben
    BackupBeginTime = ""
    BackupEndTime = ""
    BackupBeginDate = ""
    BackupEndDate = ""
    BackupNotes = "XML Datei nicht vorhanden"
    end if
    Had somebody a Info for me what I'm doing wrong :)
    Thanks & Regards
    Marius

    Hi JRV,
    I have checked my script und I have get it running by wscript.
    And I have an error with the funktion cdate:
    sName: \\S-49-NICSAS-201.nicsas.local\_logs\RH\S-49-RHBAD-001\DFS\S-49-RHBAD-001-Bad_Users.xml
    10
    27
    December 19, 2013
    C:\_scripts\xmltest.vbs(56, 3) Microsoft VBScript runtime error: Type mismatch:'cdate'
    THis is the Code:
    dfsDate = left(oneNode.text, Laenge)
    'nimm von links die 25 folgenden Zeichen (Friday, November 09, 2012)
    dfsVon = inStr(dfsDate, ",")
    'pruefe wo das 1. Komma ist und schreiben die Zeichen in die Variable
    dfsVon = dfsVon + 1
    wscript.echo dfsVon
    dfsBis = LEN(dfsDate)
    wscript.echo dfsBis
    dfsDate = mid(dfsDate, dfsVon, dfsBis)
    'Nimm die daten ab dem Komme bis zum Ende des Strings
    dfsDate = trim(dfsDate)
    'entferne die Leerzeichen Vor und Nach dem Sting
    Wscript.echo dfsDate
    dfsDate = cdate(dfsDate)
    'dfsDate = November 09, 2012 und wird in 09.11.2012 durch cdate umgebaut
    wscript.echo dfsDate
    I'm not sure why it is not working, could you help?
    Thanks & Regards
    Marius

  • Parsing XML with Java - seeking advice for method to pursue

    Hi guys
    So here's the deal: I want to parse some XML from a server, get all the data I need from it, then shunt that data to the classes that need it. However, I'm really not sure what the best way of parsing the XML is.
    I've just written a class for obtaining the file, and one for building a DOM from the XML file. But looking at org.w3c.dom in the Java API documentation (see HERE) I'll have to implement shedloads of interfaces to be able to take advantage of the DOM, and I don't even know a lot about it.
    So am I best just writing a simple parser based on regular expressions to get the data I want? There's about 5 attributes in the XML file that I need to get - 5 for each instance of the containing element. So I don't think it'll be hard to do with regular expressions.. plus even if I did decide to implement all the DOM interfaces, the only way I'd know how to do half the stuff is with regular expressions anyway. I mean, how else would you do it? How else could you match up Nodes according to the Strings you're using for the elements, attributes etc?
    I worry that a parser using regular expressions might be too slow... I'm building this as an applet to visually display information from the server. I have nothing to support those fears, I'm just not experienced enough to know whether speed would be a problem if I chose this route... I don't think it would, but really need confirmation of that suspicion being unfounded.
    Any advice would be very, very welcome, as I'm tearing my hair out at the moment, unsure what to do.

    Komodo wrote:But JDOM is not in the core class libraries, is it? So if I want to create an applet embedded into a website, am I able to get people to download that as well?
    Sorry, I don't know anything about applets.
    Komodo wrote:Everyone's advice is appreciated, but my core question remains unanswered - would using regular expressions, considering how simple and unchanging the XML files are, be a viable option in terms of speed?
    Yes! I've done more than my fair share of XML processing with REs. It's not always easy. I often wish I could just use something XPath-like. But it's certainly easy to do and would probably mean that you'd have something up and running quicker than if you spent time investigating pure XML parsing approaches.

  • Parsing XML with namespaces SOLVED

    I'm working on a SOAP-based self-service UCCX/IPIVR script where the caller inputs an account number and I call a SOAP service and get an XML result. That part works great. I used this excellent article https://supportforums.cisco.com/document/97736/uccx-8x-really-simple-soap-client-no-custom-jar to accomplish that. With slight modification to work with the particular server/service, it works flawlessly.
    My return XML file has namespaces in it with multiple sections. See attached text file with the return results.I get the same result from the SOAP call from UCCX and also from SoapUI.
    First off, my Java skills are very basic at best. Also, please forgive me if I use incorrect terms when it comes to XML nomenclature.
    I need to read each <b:Bill> section and parse the various elements within each section. I can use the statement "//*[local-name()='AssessmentType']" and get the AssessmentType element from the 1st <b:Bill> section but that's it. I don't know how to access the 2nd and subsequent <b:Bill> sections. I checked a number of different articles on various sites including the forums but I haven't found anything that I can understand let alone make work. I thought using QName was going to be my answer but I can't figure out how to make that work.The more I read about this the more confused I get.
    I found a reference somewhere using //Bills/Bill[1]/AssessmentType to access the 1st section and //Bills/Bill[2]/AssessmentType to access the 2nd section but that returns null in both instances. If I use //a:Bills/b:Bill/b:AssessmentType I get an exception, prefix must resolve to a namespace a: exception in org.Apache.xpath.domapi.XPathStylesheetDOM3Exception.
    I event tried modifying the <b:Bill> tag to <b:Bill ID="1"> and using "//*[local-name()=[@ID=1]/AssessmentType" and <Bill ID="1"> but neither of those worked. I tried removing the b: from all of the elements and tried using the same syntax but I still get null.
    I'm hoping someone can point me in the right direction on how I can do what I need to do, if it's even possible. I'm sure it is, I just don't know how to go about it.
    For testing, I just hard-coded the return XML string into a String variable, converted that to a document so I could use the Get XML Document Data step to parse it. The soapResponseStringModified variable is:
    U"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><SOAPGetBillSummaryResponse xmlns=\"http://soap.xxx\"><SOAPGetBillSummaryResult xmlns:a=\"http://schemas.xxx\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><a:ErrorMessage i:nil=\"true\"/><a:Success>true</a:Success><a:BillCount>2</a:BillCount><a:Bills xmlns:b=\"http://schemas.xxx\"><b:Bill><b:AssessmentType>Annual</b:AssessmentType><b:BillAmount>8259.96</b:BillAmount><b:BillNumber>272818</b:BillNumber><b:BillType>Secured</b:BillType><b:IsRollover>False</b:IsRollover><b:LevyAmount>7508.24</b:LevyAmount><b:RollDate>2014</b:RollDate><b:TaxStatus>Cancelled</b:TaxStatus></b:Bill><b:Bill><b:AssessmentType>Additional</b:AssessmentType><b:BillAmount>7758.24</b:BillAmount><b:BillNumber>501340</b:BillNumber><b:BillType>Secured</b:BillType><b:IsRollover>False</b:IsRollover><b:LevyAmount>7758.24</b:LevyAmount><b:RollDate>2014</b:RollDate><b:TaxStatus>Unpaid</b:TaxStatus></b:Bill></a:Bills><a:GlobalData xmlns:b=\"http://schemas.xxx\"><b:Address>123 MAIN ST</b:Address><b:City>ANY TOWN</b:City><b:EDO>19500909</b:EDO><b:IsDelinquent>true</b:IsDelinquent><b:IsVoid>false</b:IsVoid><b:ParcelNumber>00000</b:ParcelNumber><b:State>XX</b:State><b:TaxRateArea>3016</b:TaxRateArea><b:TodaysDate>20150323</b:TodaysDate><b:Zip>00000</b:Zip></a:GlobalData><a:MainRoll>false</a:MainRoll></SOAPGetBillSummaryResult></SOAPGetBillSummaryResponse></s:Body></s:Envelope>"
    Script (run in single-step mode from the IDE):
    I appreciate any guidance.
    Bill

    It looks like I found a solution to my problem. I haven't explored this for all the possible SOAP methods I have to use but this "solution" looks encouraging.
    If I do a replace() on the namespaces for a: and b: with an empty string, then replace the a:, /a:, b: and /b: with an empty string, I can use the XPath statements //Bill[1]/<FieldName>, //Bill[2]/<FieldName>, //Bill[x]/<FieldName> I can extract the data in a loop since I know the total number of bills ahead of time.
    I replace xmlns:a="http://schemas.xxx" and xmlns:b="http://schemas.xxx" with "", I can extract the elements in the Bill tags.
    It looks like this will solve my problem. It's not elegant but it works. When I loop through the elements, they' re updating appropriately based on the returned XML response.
    I'm sure there's a more elegant way to solve this problem but based on my limited coding skills, I found this a workable solution. I don't know how to use all the various Java tools available to me so this does the job.
    If someone knows the proper way to do this, I'd like to know how it's done. This will add to my toolkit and make my code easier to maintain down the road.
    Bill

  • Parsing XML with DTD residing in jar file

    Hi,
    I have problems using crimson parser for my program under JDK 1.4.0b2. It attempts to parse an xml file with SAX. The corresponding lies in a jar file in a different directory but reachable through the classpath. All I get is an exception.
    org.xml.sax.SAXParseException: Relative URI "my.dtd"; kann nicht ohne eine Dokument-URI aufgel�st werden.
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3121)
    at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3115)
    at org.apache.crimson.parser.Parser2.resolveURI(Parser2.java:2702)
    at org.apache.crimson.parser.Parser2.maybeExternalID(Parser2.java:2674)
    at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1125)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:433)
    at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:326)
    I used Xerces before and it worked fine. I already searched the community for that problem. All hints I found assume that xml file and dtd are in the same directory. Setting the systemId of the input source doesn't fix the problem.
    Is there anyone out there knowing what to do?
    Thanks,
    Thorsten

    Use a Resolver to map a PUBLIC name to a local name:
    <!DOCTYPE DOC PUBLIC "-//gaskin.de//XMLDOC 1.0//EN"
    "http://www.gaskin.de/dtd/xmldoc.dtd">
    public static register() {
       ClassLoader loader = Resolver.class.getClassLoader();
       registerCatalogEntry(
          "-//gaskin.de//XMLDOC 1.0//EN",
          "de/gaskin/resources/dtd/XMLDOC.DTD",
          loader);
    }

  • Problem while parsing xml file

    HI
    I have a xml file which looks like this
              <--A>
    <ID>ABCD</ID>
                   <--B>
                   <Amount1>1</Amount1>
                   <Amount2>2</Amount2>
                   <--/B>
                   <--B>
              <Amount1>3</Amount1>
                   <Amount2>4</Amount2>
                   <--/B>
              <--/A>
              <--A>
    <ID>EFGH</ID>
                   <--B>
                   <Amount1>5</Amount1>
                   <Amount2>6</Amount2>
                   <--/B>
                   <--B>
              <Amount1>7</Amount1>
                   <Amount2>8</Amount2>
                   <--/B>
              <--/A>
    (Appended -- before tags so that its displayed properly here)
    I have to parse through this xml file and for each ID,i have to display corresponding amounts.As we can see //A represents each row.
    I have written code like this.
    l_clob := '<<<XML Content as shown above >>>;
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    -- Free resources associated with the CLOB and Parser now they are no longer needed.
    dbms_xmlparser.freeParser(l_parser);
    l_nl1 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//A');
    FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl1) - 1 LOOP
    l_n1 := dbms_xmldom.item(l_nl1, cur_rec);
    lv_id := dbms_xslprocessor.valueOf(l_n1,'ID/text()');
    l_nl2 := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'//B');
    FOR cur_rec2 IN 0 .. dbms_xmldom.getLength(l_nl2) - 1 LOOP
    l_n2 := dbms_xmldom.item(l_nl2, cur_rec2);
    lv_Amount1 := dbms_xslprocessor.valueOf(l_n2,'Amount1/text()');
    lv_Amount2 := dbms_xslprocessor.valueOf(l_n2,'Amount2/text()');
    dbms_Output.put_line (lv_id ||lv_Amount1|| lv_Amount2 );
    end loop;
    end loop;
    The problem i am facing is , in the second loop i want to disdplay only values corresponding to ID which is coming in first loop.But when i give //B,its going through all the values in xml file under //B but not going through //B part of each record fethed in loop1.
    How can we display Each ID and corresponding amounts only(Not all the Amounts in XML File).
    Thanks
    Pramod
    Edited by: 842802 on Mar 21, 2011 9:27 AM

    No need for Pl/SQL:
    with t as (
    select '<A>
    <ID>ABCD</ID>
    <B>
    <Amount1>1</Amount1>
    <Amount2>2</Amount2>
    </B>
    <B>
    <Amount1>3</Amount1>
    <Amount2>4</Amount2>
    </B>
    </A>
    <A>
    <ID>EFGH</ID>
    <B>
    <Amount1>5</Amount1>
    <Amount2>6</Amount2>
    </B>
    <B>
    <Amount1>7</Amount1>
    <Amount2>8</Amount2>
    </B>
    </A>' x from dual
    select  id,
            amount1,
            amount2
      from  t,
            xmltable(
                     '$d/D/A'
                     passing xmltype('<D>' || x || '</D>') as "d"
                     columns id varchar2(10) path 'ID',
                             B xmltype path '/'
                    ) y,
            xmltable(
                     '$d/A/B'
                     passing y.b as "d"
                     columns amount1 number path '/B/Amount1',
                             amount2 number path '/B/Amount2'
                    ) z
    ID            AMOUNT1    AMOUNT2
    ABCD                1          2
    ABCD                3          4
    EFGH                5          6
    EFGH                7          8
    SQL> SY.

  • Parsing xml with dom4j - cannot find jar file

    Hi,
    I'm using Jdeveloper 10g and tomcat 5.5.9. I have a servlet which calls a java class (ParseXML.java) that trys to parse an xml string using dom4j. A snippet of ParseXML.java...
    import org.dom4j.Document;
    import org.dom4j.DocumentException;
    import org.dom4j.io.SAXReader;
    public class ParseXML  {
    public ParseXML(String xml) {
              this.XML_STRING = xml;
         public String parse() {
              SAXReader reader = new SAXReader();
              Document document = null;
              try  {
                   document = reader.read(XML_STRING);
                   } catch (DocumentException de)  {
                   return de.getMessage();
              } catch (Exception e) {
                   return e.getMessage();
                   return "The xml root value is: " + document.getRootElement().getName();
    } I've downloaded the dom4j 1.6.1 jar and put it on the project class path (specified in the jdev project proerties), and my code also compiles ok. But when i try to instantiate ParseXML from my servlet i get a runtime exception:
    javax.servlet.ServletException: Servlet execution threw an exception
    root cause
    java.lang.NoClassDefFoundError: org/dom4j/DocumentException
         arcims.GetMapServlet.doPost(GetMap.java:45)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802I'm not sure if this is a class path issue or something else; i've checked and rechecked the classpath and nothing seems amiss.
    Suggestions, anyone?

    Question: Is it really necessary to use a
    StringReader if my xml document is not saved to disk?
    I get XML_STRING from a web service, convert it into
    a xml document so i can manipulate/parse it, but then
    i don't save the document, i just discard it. How
    does my system's default character set affect string
    manipulations that i do within my java app?Your system's default charset doesn't have anything to do with string manipulations, if by that you mean substrings and concatenations of strings. It is used when you convert strings to bytes and bytes to strings. If your string contains a character that can't be handled by your default charset, then converting that string to bytes will put ? in place of that character. Converting those bytes back to a string will leave the ? as is. Thus your string has been changed.
    Also converting the string to bytes can have bad results, because the first thing the XML parser does is to convert the bytes back to a string, using the charset declared in the XML. If this charset is different from your system's default, then your XML may be corrupted by this process if it contains characters that are encoded differently in the two charsets. The typical example of this is European accented letters like �, which are encoded differently in ISO-8859-1 or Windows-1252 (most people's default charsets) and UTF-8 (the default XML charset).
    Besides, converting the string to bytes just so it can be immediately converted back to a string is rather wasteful.

  • 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

Maybe you are looking for

  • Custom Page Type

    Is there a way of hiding the Category and Keyword base attributes on a custom page as there is when creating a Custom Item Type? Is it possible to create a page template from a custom page? I just get "Error while copying page. (WWC-44262) (WWC-00000

  • RE connecting my wireless printer

    Hi Guys I have used my HP Desljet 3050A for years, both by cable and wirelessly, but mainly wirelessly. I recently had a problem concerning an error message telling me my printer was in error state. I solved that problem by deleting my printer from p

  • Illustrator is not picking up my shapes library, how can I get them syncing properly?

    I'm using my iphone 5s to take vector images and them which should then save them directly to my cloub library but I cant find them anywhere and there are no libraries showing at all in my illustrator CC. Any suggestions?

  • Acrobat Extended 9 - rh file import compatibility - Right Hemisphere

    Hello, does anyone have an idea how to geht a plugin for importing the rh format in acrobat extended? The file compatibility was in acrobat 8 3d, but after the toolkit (deep exploration) is missing in the 9th version i have troubles importing 3dsmax

  • How do I chat between users that are under one .mac/MobileMe family acct?

    How do I chat between users that are under one .mac/MobileMe family acct? We are all under one account, but in different locations, using iChat 4.0.5 and OS 10.5.4. Thank you.