Problem parsing xml in J2ME (using kxml2)

Hello.
May someone who knows how to use kxml help me please?
I'll try to be straight forward. (Please excuse my imperfect English)
My xml file look something like this:
<?xml version="1.0" encoding="utf-8"?>
<sample_tag1 xmlns:mysample="http://www.sample001.com/sample01schema">
<feature name=”tag1_feature”>
     <test name=”xxxxx” id=”200” message=”Hello.”></test>
</feature>
<catalog name="shelf">
     <booklist name="book1" label="b1"></booklist>
     <booklist name="book2" label="b2"></booklist>
     <booklist name="book3" label="b3"></booklist>
</catalog>
</sample_tag1>
And here's my code
          //http request
               try{
               //I can guarantee that the URL is valid
httpConnection = (HttpConnection) Connector.open(URL);
}catch(IOException ioe){
ioe.printStackTrace();
               //Create the parser
KXmlParser parser = new KXmlParser();
try{
                    //I use this code section to test if the xml file is properly placed in the inputStream.
char[] tempChar = new char[500];
isr = new InputStreamReader(httpConnection.openInputStream());
isr.read(tempChar);
for(int i=0; i<tempChar.length;i++){
System.out.print(tempChar);
//set the xml input
parser.setInput(isr);
//skip the "<?xml version="1.0" encoding="utf-8"?>" tag
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, "sample_tag1");
                    System.out.println("name : " + parser.getName());
System.out.println("namespace : " + parser.getNamespace());
parser.nextTag(); // ***1
I compiled the app and run, here's the result:
name : sample_tag1
namespace :
org.xmlpull.v1.XmlPullParserException: attr value delimiter missing! (position:START_TAG <feature name='http://www.sample001.com/sample01schema'>@3:15 in java.io.InputStreamReader@e938beb1)
at org.kxml2.io.KXmlParser.exception(+47)
at org.kxml2.io.KXmlParser.error(+45)
at org.kxml2.io.KXmlParser.parseStartTag(+285)
at org.kxml2.io.KXmlParser.nextImpl(+314)
at org.kxml2.io.KXmlParser.next(+23)
at org.kxml2.io.KXmlParser.nextTag(+24)
at MyMidlet$ReadXML.run(MyMidlet.java:235)
But when I comment the last line (parser.nextTag(); // ***1), here's the result:
name : sample_tag1
namespace :
My code is the clone of the one in this tutorial:
http://www.developer.com/ws/article.php/3759471
where he get the weather forecast from Yahoo Weather RSS
What did I do wrong? I tried looking up google for "attr value delimiter missing!" but found no useful information.
Thank you in advance. =)

Please read this topic. I posted an answer about parsing xml using kxml2
http://forums.sun.com/thread.jspa?threadID=5291592&start=0&tstart=0
Regards,
David

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 parsing xml(J2ME Web Service spec) containing image in cldc/midp

    Hi,
    I have created a restful web service that generates xml file in app server. I have created xml file using JAXB2.1 spec. This xml file has many elements starting from char data to image (binary data). I could successfully create xml file and developed another test client to read the same file using JAXB. However, I am finding a problem while getting the image in the java me client (cldc1.1 and midp2.0).
    I am using J2ME Web Services Specification, using javax.xml.parsers.SAXParser to parse the xml file. Parsing is successful and got the character data. But the image data is not accurate, so I am not getting the image. I suspect the problem is with encoding but not sure how to solve this. At the server end, I verified that xml file is encoded with "UTF-8" encoding, not sure how to decode at the client end.
    I am totally confused as how to get the accurate image data, not sure if I use kxml parser would solve my problem.
    I would really appreciate if somebody can get back to me as this is very very important.

    Try to send to your web service the byte array instead of string and then convert the byte array into an image
    using a method like the following one in your service:
    // C# code
    public Image ByteArrayToImage(byte[] byteArrayIn)
         MemoryStream ms = new MemoryStream(byteArrayIn);
         Image returnImage = Image.FromStream(ms);
         return returnImage;
    }There can be some problem between encoding in J2ME and .Net so try different encodings in gathering the image bytes in your j2ME application, but, instead of jpg which has more encodings, try png that is a more standardized image compression(open standard).

  • Can't parse xml from applet using dom on linux on Netscape 7 using jre 1.4.

    Hi,
    I can't seem to parse xml from an applet on linux on Netscape 7 using the JRE 1.4.
    My code looks like the following:
    StringBufferInputStream is = new StringBufferInputStream("<foo></foo>");
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
    try
      builder = factory.newDocumentBuilder();
      domDocument = builder.parse(is); // this line creates an exception
    catch (Exception e)
      System.out.println(e);
    This code works fine from an applet on windows. On linux, the error message is:
    java.security.AccessControlException: access denied (java.util.PropertyPermission entityExpansionLimit read)
    I've tried both JRE 1.4.0_04 and 1.4.1_03
    Thanks!
    Q

    There's another posting about this same problem (platform unspecified), but the same error message. I was also having this problem (Windows 1.4.03) and swithced back to 1.4.01 and the problem went away. In the future, I may sign my applets to get a more generous security policy. But, I'm sure it'll be a lot of work (vs. a line of code somewhere).

  • JSTL - Problem parsing XML file w/ XML schema declarations

    I'm having trouble parsing an xml document that contains XML schema declarations in the root element. I've included 2 snippets, the XML files they're supposed to parse, and their output below. The first one works and the second one doesn't. Could someone please tell me why? I find it hard to believe that no one's run into this before.
    I'm running Tomcat 5.5 and I'm using JSP 2.0, jakarta standard taglibs jars (1.1.2), jdk 1.5.0_04, and the Xalan 2.7.0 jars.
    Here's the first snippet:
    <c:import url="/WEB-INF/config/schools.xml" var="xml" />
    <x:parse doc="${xml}" var="schoolList"/>
    There are <x:out select="count($schoolList//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList//school">
         <x:out select="name"/><br/>
    </x:forEach>it parses the following xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <schools>
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and it outputs:
    There are 3 schools in the file:
    Tumwater Middle School
    Garfield High School
    Tigard High School-----------------------------------------
    The second snippet:
    <c:import url="/WEB-INF/config/schools2.xml" var="xml2" />
    <x:parse doc="${xml2}" var="schoolList2"/>
    There are <x:out select="count($schoolList2//school)"/> schools in the file:<br/>
    <x:forEach select="$schoolList2//school">
         <x:out select="name"/><br/>
    </x:forEach>parses this xml file (note the xml schema declarations):
    <?xml version="1.0" encoding="UTF-8"?>
    <schools xmlns="http://www.serenus.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.serenus.com schools.xsd">
         <school id="34033">
              <name>Tumwater Middle School</name>
              <district>Tumwater</district>
              <type>middle</type>
              <active>false</active>
         </school>
         <school id="17001">
              <name>Garfield High School</name>
              <district>Seattle</district>
              <type>high</type>
              <active>true</active>
         </school>
         <school id="00023">
              <name>Tigard High School</name>
              <district>Tigard-Tualatin</district>
              <type>high</type>
              <active>true</active>
         </school>
    </schools>and its output is:
    There are 0 schools in the file:That's it! No errors at all! I'm 100% certain the variable names, filenames, etc. are correct. I've looked everywhere for an existing answer to this problem, but I can't find one. Is this a known issue? Please help.
    -Ben

    Hi Ben,
    I got exactly the same problem and also could not find any solution.
    Did you find a way out for this problem meanwhile?
    Any help is welcome!

  • Problem parsing XML

    i created a class extending the HandlerBase class of the nanoXML package. this class successfully compiled but gave a java.lang.defClassNotFound error, during preverification, Using sun's wireless toolkit(JWTK). What Is The Problem?

    Hi
    You have to place the xml parsing library inside the lib directory under the WTK.
    Mihai

  • Having a problem parsing XML from web service & dropdown list

    I have 2 data connections that are programmatically invoked via exit event on different fields in form.  Both have identical code with only difference is that one populates a multiselect list box and one populates a drop down list.  The one that populates the listbox works fine.  Everytime Field A changes, it is fired and the results parsed then listblox updated.  The one with the drop down list is not working at all.  The form is used in Workspace.  When I use the javascript debugger, I see the correct node values output to the console window.  The problem is that the value is not successfully added to the drop down list existingFileNumber.  Anyone have any great ideas?  Like I said, this works perfectly in the same form for a different web service and a listbox.
    Here is the code for firing and parsing the dropdown list data:
    Form.sRoutingTransmittalSlip.sPreparer.existingFileNumber.clearItems();
    Form.sRoutingTransmittalSlip.phaseHidden.rawValue="PI";
    xfa.connectionSet.getInfo.execute(0);
    var pls2=xfa.datasets.createNode("dataGroup","pls2");
    pls2.loadXML(Form.sRoutingTransmittalSlip.fileNumbersHidden.rawValue,false,true);
    xfa.datasets.data.nodes.append(pls2);
    var dataGroup=xfa.resolveNode("xfa.data.pls2.Matters");
    var dataGroupLength=dataGroup.nodes.length;
    if (dataGroupLength==0) {}
    else {
      for (var i=0;i<dataGroupLengthl;i++){
         console.println(dataGroup.nodes.item(i).nodes.item(0).value);
         Form.sRoutingTransmittalSlip.sPreparer.existingFileNumber.addItem(dataGroup.nodes.item(i ).nodes.item(0).value);

    Do this instead
    [Bindable]
    var xlTopics:XMLListCollection;
    private function LoadResults(event:ResultEvent):void{
    var xmlResult = XML(event.result); //only use lastResult in
    binding expressions
    trace(xmlResult.toXMLString()); //to be sure of what you have
    xlTopics = new XMLListCollection(xmlResult .children());
    //all the child nodes of the root
    Tracy

  • Problem in XML Message creation using ABAP Proxy

    Hi,
    I am trying to send the data from ECC to CRM when post goods issue is done for a delivery from ECC side using ABP Proxy. I called my proxy method in BADI : DELIVERY_PUBLISH.
    And after calling the method, I used commit work also.
    But the problem is, some times it is working fine. and some times the XML messages are not getting created. When I go in debug, looks everything is fine.
    I am unable to understand why this inconsistency.
    Could you please help me out, do I need to take any more precautions.
    Thanks,
    Sandeep

    Hi,
    There is no problem in the proxy. Some small problem in the database update.
    It is solved.
    cheers
    san

  • Parsing Xml in J2me?

    Hye,
    i am using the following block of code in my program. This program when executes, shows an error of END_TAG need to be expected. well, i have defined the tags and i am not getting how to reslove this error....
    Can anyone helps me out???
    void XMLparser ( InputStreamReader reader )throws IOException
         try
              XmlPullParserFactory factory =      XmlPullParserFactory.newInstance(
                                  System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
                   XmlPullParser parser = factory.newPullParser();
                   try
                   {                                                                      factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
                   catch (XmlPullParserException ex)
                   System.err.println("This is not a validating parser");
                   parser.setInput(reader);          
                   int eventType = parser.getEventType();
                   int count = 0;
                   while (eventType != XmlPullParser.END_DOCUMENT)
                        if(eventType == XmlPullParser.START_DOCUMENT)
                             textField.setString("Searched: "+word);
                             System.out.println(word);
                        else if(eventType == XmlPullParser.END_DOCUMENT)
                             System.out.println("End Doc");
                        else if(eventType == XmlPullParser.START_TAG)
                             if(parser.getName().equals("dictionary"))
                                  String string = parser.nextText();
                                  System.out.println("Dictionary");
                             else if(parser.getName().equals("meanings"))
                                  String string = parser.nextText();     
                                  System.out.println("Meanings");
         (parser.getName().equals("meaning"));                         {
                                  String string = parser.nextText();
                        else if(eventType == XmlPullParser.END_TAG)
                        System.out.println("End Tag");
                        else if(eventType == XmlPullParser.TEXT)
                             System.out.println("Meanings!!");
                        eventType = parser.next();
                   }// while close     
         }// try close
         catch (XmlPullParserException ex)
              ex.printStackTrace();
         }// XMLparser() close

    Hye,
    i am using the following block of code in my program. This program when executes, shows an error of END_TAG need to be expected. well, i have defined the tags and i am not getting how to reslove this error....
    Can anyone helps me out???
    void XMLparser ( InputStreamReader reader )throws IOException
         try
              XmlPullParserFactory factory =      XmlPullParserFactory.newInstance(
                                  System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
                   XmlPullParser parser = factory.newPullParser();
                   try
                   {                                                                      factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
                   catch (XmlPullParserException ex)
                   System.err.println("This is not a validating parser");
                   parser.setInput(reader);          
                   int eventType = parser.getEventType();
                   int count = 0;
                   while (eventType != XmlPullParser.END_DOCUMENT)
                        if(eventType == XmlPullParser.START_DOCUMENT)
                             textField.setString("Searched: "+word);
                             System.out.println(word);
                        else if(eventType == XmlPullParser.END_DOCUMENT)
                             System.out.println("End Doc");
                        else if(eventType == XmlPullParser.START_TAG)
                             if(parser.getName().equals("dictionary"))
                                  String string = parser.nextText();
                                  System.out.println("Dictionary");
                             else if(parser.getName().equals("meanings"))
                                  String string = parser.nextText();     
                                  System.out.println("Meanings");
         (parser.getName().equals("meaning"));                         {
                                  String string = parser.nextText();
                        else if(eventType == XmlPullParser.END_TAG)
                        System.out.println("End Tag");
                        else if(eventType == XmlPullParser.TEXT)
                             System.out.println("Meanings!!");
                        eventType = parser.next();
                   }// while close     
         }// try close
         catch (XmlPullParserException ex)
              ex.printStackTrace();
         }// XMLparser() close

  • Problems parsing xml

    I am currently writing a program that receives and xml address, parses the file and finds the name of a certain graphic file named in the xml file. Now if this was Perl I'd be all set, but doing it with java is confusing me a bit. I currently have Xerces SAX all set up, but I'm not sure exactly how to search through the file and find something. Thanks in advance!

    Thought I should give an example of the xml file i am parsing. I access it through a URL, which displays this:
    <?xml version="1.0" ?>
    - <map>
    <image href="http://localhost/TransCADTempFiles/a2aeb27f8.png" scope="-71104104|42365514|0.99284|0.8" width="520" height="420" />
    <directions href="http://localhost" />
    </map>
    The only thing that will ever change is the png file.
    Thanks!!

  • Problem parsing an XML

    I have this servlet that should be parsing a string received using a HTTP POST, here is the code of the servlet:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.InputSource;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.apache.xml.serialize.*;
    import org.xml.sax.InputSource;
    public class SMSReceiver extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    try {
    //Initialization for the servlet
    ServletInputStream entrada = req.getInputStream();
    ServletOutputStream salida = res.getOutputStream();
    //Reading of the entering string
    BufferedReader lector = new BufferedReader(new InputStreamReader (entrada));
    res.setContentType("text/HTML");
    try {
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource inStream = new InputSource();
    inStream.setCharacterStream(new StringReader(lector.readLine()));
    Document doc1 = builder.parse(inStream);
    NodeList listasms = doc1.getElementsByTagName("sms");
    for(int s=0; s<listasms.getLength() ; s++)
    Node nodosms = listasms.item(s);
    if(nodosms.getNodeType() == Node.ELEMENT_NODE)
    Element elementosms = (Element)nodosms;
    NodeList listatelf = elementosms.getElementsByTagName("tlf");
    Element elementotelf = (Element)listatelf.item(0);
    NodeList textTelfList = elementotelf.getChildNodes();
    String telefono = ((Node)textTelfList.item(0)).getNodeValue();
    salida.println("Telefono" + telefono);
    NodeList listaop = elementosms.getElementsByTagName("op");
    Element elementoop = (Element)listaop.item(0);
    NodeList textOpList = elementoop.getChildNodes();
    String operadora = ((Node)textOpList.item(0)).getNodeValue();
    NodeList listasc = elementosms.getElementsByTagName("sc");
    Element elementosc = (Element)listasc.item(0);
    NodeList textSCList = elementosc.getChildNodes();
    String shortcode = ((Node)textSCList.item(0)).getNodeValue();
    NodeList listabody = elementosms.getElementsByTagName("body");
    Element elementobody = (Element)listabody.item(0);
    NodeList textBodyList = elementobody.getChildNodes();
    String body = ((Node)textBodyList.item(0)).getNodeValue();
    catch (SAXParseException err)
    salida.println ("** Parsing error" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());
    salida.println(" " + err.getMessage ());
    catch (SAXException e)
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    catch (Throwable t)
    t.printStackTrace ();
    The error I get from the servlet is:
    ** Parsing error, line 1, uri null
    XML document structures must start and end within the same entity.
    Finished executing
    Here's the code of the program that sends the HTTP POST:
    import java.io.*;
    import java.net.*;
    import java.io.*;
    public class HTTPSender {
    public static void main(String[] args) throws Exception {
    try {
    String cadena = ""
    + "<root>\n"
    + "<sms>\n"
    + "<tlf>" + (URLEncoder.encode("4123161640" , "UTF-8")) + "</tlf>\n"
    + "<op>" + (URLEncoder.encode("D" , "UTF-8")) + "</op>\n"
    + "<sc>" + (URLEncoder.encode("0000" , "UTF-8")) + "</sc>\n"
    + "<body>" + (URLEncoder.encode("PRUEBA DE MENSAJE MOVIL+" , "UTF-8")) + "</body>\n"
    + "</sms>\n"
    + "</root>";
    //URL url = new URL("http://200.74.214.222:8080/MovilPlus/MovilPlusResponse");
    URL url = new URL("http://localhost:8080/SMSconnector/SMSReceiver");
    int i = 0;
    while (i!=1) {
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(cadena);
    wr.flush();
    // Get the response
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    System.out.println(line);
    wr.close();
    rd.close();
    i = i + 1;}
    } catch (Exception e) {
    Now anybody could tell me WHAT I'M DOING WRONG???? Please, need real help here. I'm JAVA newbie but in desperation. Thanks!

    Yes, that's the problem kcounsel, thanks for your help, now I'm parsing I modified my code to store the data into a DATABASE, the problem is that it's not storing and neither giving me any exception for the DB, here's the code to see if you can manage something here:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.BufferedReader;
    import java.io.FileWriter;
    import java.io.PrintWriter;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.w3c.dom.*;
    import org.apache.xml.serialize.*;
    import java.net.URLDecoder;
    import java.sql.*;
    import org.xml.sax.InputSource;
    import java.io.StringReader;
    * This class is made as a servlet for receiving strings and saving
    * them as DB records and XML files, it will save each sms in a different XML
    * generating the automatic number of the SMS.
    * <p>Bugs: (None untill now, please notify if you find one)
    * @author (Helder Martins ([email protected]))
    public class SMSReceiver extends HttpServlet
    //Public variables we will need
    public String Stringid;
    public String Stringpath;
    public String st;
    public int nid;
    //Servlet service method, which permits listening of events
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    //Initialization for the servlet
    ServletOutputStream salida = res.getOutputStream();
    ServletInputStream entrada = req.getInputStream();
    try {
    //Reading of the entering string
    BufferedReader lector = new BufferedReader(new InputStreamReader (entrada));
    res.setContentType("text/HTML");
    //Database handler
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection Conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/smsdb","root", "");
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource inStream = new InputSource(entrada);
    Document doc1 = builder.parse(inStream);
    NodeList listasms = doc1.getElementsByTagName("sms");
    for(int s=0; s<listasms.getLength() ; s++)
    Node nodosms = listasms.item(s);
    if(nodosms.getNodeType() == Node.ELEMENT_NODE)
    Element elementosms = (Element)nodosms;
    NodeList listatelf = elementosms.getElementsByTagName("tlf");
    Element elementotelf = (Element)listatelf.item(0);
    NodeList textTelfList = elementotelf.getChildNodes();
    String telefono = ((Node)textTelfList.item(0)).getNodeValue();
    //String SendingAddress = ((Node)textAddressList.item(0)).getNodeValue().trim();
    salida.println("Telefono " + telefono);
    NodeList listaop = elementosms.getElementsByTagName("op");
    Element elementoop = (Element)listaop.item(0);
    NodeList textOpList = elementoop.getChildNodes();
    String operadora = ((Node)textOpList.item(0)).getNodeValue();
    salida.println("Operadora " + operadora);
    NodeList listasc = elementosms.getElementsByTagName("sc");
    Element elementosc = (Element)listasc.item(0);
    NodeList textSCList = elementosc.getChildNodes();
    String shortcode = ((Node)textSCList.item(0)).getNodeValue();
    salida.println("Shortcode " + shortcode);
    NodeList listabody = elementosms.getElementsByTagName("body");
    Element elementobody = (Element)listabody.item(0);
    NodeList textBodyList = elementobody.getChildNodes();
    String body = ((Node)textBodyList.item(0)).getNodeValue();
    salida.println("Body " + body);
    Statement sta = Conn.createStatement();
    sta.executeUpdate("INSERT INTO smstable (telf,op,sc,body) VALUES ('" + telefono + "','" + operadora + "','" + shortcode + "','" + body + "')");
    Conn.commit();
    Conn.close();
    //Catching errors for the SAX and XML parsing
    catch (SAXParseException err)
    salida.println ("** Parsing error" + ", line " + err.getLineNumber () + ", uri " + err.getSystemId ());
    salida.println(" " + err.getMessage ());
    catch (SAXException e)
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    catch (Throwable t)
    t.printStackTrace ();

  • Problems in transforming XML to HTML using HP-UX with Netscape Enterprise Server 4.0 sp3

    Hi,
    Has anyone ever had any problem using XML in NES 4.0 sp3?
    I'm using the libraries com.sun.xml.parser, com.sun.xml.tree, javax.xml.transform.
    The html is being created but is not being returned.
    (it is not showed in browser)
    This same xml application works well in Solaris with Iplanet Web Server 4.1, but it is not working in HP-UX with Netscape Enterprise Server 4.0 sp3.
    I'm entirely lost. I don't know if there is a bug in this version (NES 4.0) or if I need other xml libraries or it is a problem of JRE version.
    Any comments will be appreciate.
    Thanks

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Norbert Clavaux ([email protected]):
    Hi,
    Last year we built a complete new website, based on XML/XSL.
    We assumed all browsers would cope with XSL by now, but that was far to optimistic.
    Our company planned to launch the new site this december, but XSL is giving us some major problems:
    *** All our customers are obliged to use Internet Explorer 4/5.x. Some don't like that at all: they stick to Netscape.
    *** IE users have to download and install the MS-XSL parser. At our pilotsites this is giving a lot of trouble and frustration.
    I heard that it is possible to do the parsing at the serverside, using XSLT, creating HTML.
    HOW CAN WE INSTALL / IMPLEMENT THIS OPTION IN OUR CONFIGURATION?
    (PL/SQL / IAS 9i / Sun Solaris / Oracle 8.1.2)
    Thanks in advance,
    Norbert Clavaux
    Nederlandse Bibliotheek Dienst
    The Netherlands<HR></BLOCKQUOTE>
    You could use DB Prism / Cocoon CMS.
    This CMS is built on top of Apache Cocoon Framework and DB Prism servlet engine.
    This CMS stores the assets in the DB (CLOB) and applys the stylesheet at runtime.
    If you need more information about this CMS look at is free.
    This CMS builts the DB Prism web site at www.plenix.com/dbprism/
    Best regards, Marcelo.

  • Generating XMLs from CSVs using DOM parser......

    Hi,
    I am trying to generate XMLs from CSV files using DOM parser. XMLs are getting generated but the problem is that i am using Encoding "ISO-8859-1" but XMLs are getting generated in UTF-8 encoding.
    Please refer to the code below and advice. (where are the code tags gone ????? )
    Source domSource = new DOMSource(document);
    ByteArrayOutputStream xmlStream = new ByteArrayOutputStream();
    Result result = new StreamResult(xmlStream);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(domSource, result);
    xmlStream.close();
    generatedXml = new String(xmlStream.toByteArray(), "*ISO-8859-1*");

    Use transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1") to specify the character set.

  • Importing/Parsing XML using SQL and/or PL/SQL

    What is the recomended way of importing/parsing XML data using SQL and/or PL/SQL?
    I have an XSD that defines the structure of the file, and an XML file that has the content in the appropriate structure. I have parsed (checked) the structure of the XML file using JDOM in my java application, and then passed it to a function in a package on the database as a CLOB.
    What I need to do is parse the contents of the XML file that is passed into the function and extract the values of each XML element so that I can then do some appropriate validation before inserting and committing the data to the database (hence completing the import function).
    A DBA colleague of mine has been experimenting with various ways of acheiving this, but has encountered a number of problems along the way, one of which being that he thinks that it is not possible to parse XML elements that are nested more than four levels deep - is this the case?
    The structure of the XSD/XML that the database function needs to manipulate and import data from is very complex (and recursive by it's nature).
    I would appreciate any suggestions as to how I can achieve the above in the most efficient manner.
    Thanks in advance for your help
    David

    This is the forum for the SQLDeveloper tool. You will get better answers in the SQL and PL/SQL forum, and especially the XML DB forum.
    Oracle has comprehensive and varied support for XML, including a PL/SQL parser.

  • 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

Maybe you are looking for

  • Illustrator will no longer work after Yosemite upgrade!!!

    I downloaded Yosemite on my Macbook Pro and now Illustrator will no longer work. A warning pops up that I need the newest Java runtime which I already have. What should I do? Please help

  • New Mac Mini's

    Has anybody purchased one of these? I have been tossing around the idea of using one in my home theater for playing video podcasts, home videos, surfing the web, etc on the big screen... I currently use a 1st gen MacBook as part of my home theater, b

  • How is the Login-validation.xml file is called when we do the validation i

    Hi ^^, please forgive me if I am a big long while explaining. when you are using the struts 2.0 the web.xml has a welcome-file-list. I have put index.html in that list so it pulls up first. It has the following tag <ul>           <li><a href="roseind

  • I can't find the Signature option in the Annotations menu in Preview

    I am trying to add a digital signature that I have already created to a PDF file but there is no Signature option showing up in the Annotations menu in Preview. The document I am trying to add the signature to is definitely a PDF but there is still n

  • Purchase Order for Prepaid Expenses

    HI Guys, I want to do a PO for a Prepaid Expense ( a balance sheet account).  There's no account determination that helps me to do this since the only available AAM for balance sheet items are " " or blank for Inventory and A for Assets. How would yo