×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    11

    Parsing wbxml file to xml file using kxml parser

    hi,

    I am parsing xml file to wbxml using kxml parser but while parsing back the wbxml file to xml file, I getting the error

    java.io.IOException: Curr. only CP0 supported
    at org.kxml.wap.WbxmlParser.peek(+302)
    at org.kxml.kdom.Node.parse(+6)
    at org.kxml.kdom.Document.parse(+5)
    at XMLtoWBXML.getXMLStream(XMLtoWBXML.java:115)
    at XMLtoWBXML.startApp(XMLtoWBXML.java:67)
    at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:44)
    at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:375)
    at com.sun.midp.main.Main.runLocalClass(Main.java:477)
    at com.sun.midp.main.Main.main(Main.java:130)

    xml file that i am parsing is:

    <?xml version="1.0" encoding="utf-8"?>
    <Sync xmlns="AirSync:" xmlns:A="POOMCONTACTS:">
    <Collections>
    <Collection>
    <Class>Contacts</Class>
    <SyncKey>{6A374473-D63E-45FA-8556-129C8C1C3CFA}11</SyncKey>
    <Status>1</Status>
    <Commands>
    <Add>
    <ServerId>rid:01c133474e27d04faba48d02078cf41d00000090e129
    </ServerId>
    <ApplicationData>
    <A:FileAs>Mouse, Mickey</A:FileAs>
    <A:FirstName>Mickey</A:FirstName>
    <A:LastName>Mouse</A:LastName>
    <A:BusinessPhoneNumber>(425) 555-1212</A:BusinessPhoneNumber>
    </ApplicationData>
    </Add>
    </Commands>
    </Collection>
    </Collections>
    </Sync>

    the code which i am using for Parsing wbxml to xml:
    public byte[] getXML( byte[] wbxmlData ) { // wbxml to xml
    try {

    ByteArrayInputStream in = new ByteArrayInputStream(wbxmlData);
    AbstractXmlParser parser = new WbxmlParser(in);

    Document document = new Document ();
    document.parse(parser); (error pointing here)
    in.close();
    ByteArrayOutputStream out = new ByteArrayOutputStream();

    XmlWriter writer = new XmlWriter(new OutputStreamWriter( out ) );
    document.write(writer);
    writer.close();

    wbxmlData = out.toString().getBytes();
    out.close();

    }
    catch(IOException ioe){
    System.out.println(" in ioe: ");
    ioe.printStackTrace();
    }
    catch (Exception e)
    {e.printStackTrace();}
    return wbxmlData;
    }

    also i want to parse data between the tags <ApplicationData>
    <A:FileAs>Mouse, Mickey</A:FileAs>
    <A:FirstName>Mickey</A:FirstName>
    <A:LastName>Mouse</A:LastName>
    <A:BusinessPhoneNumber>(425) 555-1212</A:BusinessPhoneNumber>
    </ApplicationData>

    where A is xml namespace.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    And how do your WBXML codepages look like? Is there any reason to decode the WBXML to XML again at all?

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    the output of xml to wbxml will in this format, here i am not able to make out the code pages

    wbxml ?Sync xmlns xmlns:A Collections Collection Class SyncKey Status Commands Add ServerId ApplicationData A:FileAs A:FirstName A:LastName A:BusinessPhoneNumber 


    Ä AirSync:  POOMCONTACTS: 


    D


    D


    D*Contacts 


    D0{6A374473-D63E-45FA-8556-129C8C1C3CFA}11 


    D81 


    D?


    DH


    DLrid:01c133474e27d04faba48d02078cf41d00000090e129


    


    DU


    DeMouse, Mickey 


    DnMickey 


    DzMouse 


    D?(425) 555-1212 


    


    


    


    


    


    


    but i just want to take data present in between <ApplicationData>
    <A:FileAs>Mouse, Mickey</A:FileAs>
    <A:FirstName>Mickey</A:FirstName>
    <A:LastName>Mouse</A:LastName>
    <A:BusinessPhoneNumber>(425) 555-1212</A:BusinessPhoneNumber>
    </ApplicationData>

    but how to take (parse) this firstname-Mickey, lastname-Mouse, phonenumber->(425) 555-1212 in wbxml is my need. no need to convert it back to xml format.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    I do not understand you. Could you please elaborate a bit more and/or try again. Have you converted the data to WBXML? Then you have defined at least one TAG_TABLE (string array which contains the tag to id mapping).

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    My requirement is , i need to parse the <sync> </sync> xml file to wbxml file and fetch the data present in between tags<Application> </Application> and store firstname, lastname and phone number in mobiles pim.

    i m using kxml parser to parse the data and program goes like this:

    try{
    ByteArrayInputStream in = new ByteArrayInputStream(resultbyte);// resultbyte is wbxml form of above <sync> </sync> xml file.
    WbxmlParser parser = new WbxmlParser(in);

    parseAddressTag( parser );

    List list = new List(" contact List", Choice.IMPLICIT);
    for(int i =0; i<vector.size(); i++){
    list.append(vector.elementAt(i).toString().trim(),null);
    System.out.println(" vec " + vector.elementAt(i).toString().trim());
    }
    Display.getDisplay(this).setCurrent(list);

    } catch (IOException ioe) {

    System.err.println("XML Parsing Error: " + ioe);
    ioe.printStackTrace();
    }
    }

    }
    public void parseAddressTag( WbxmlParser parser ) throws IOException {
    ParseEvent event = null;

    event = parser.read();

    while ((event = parser.peek()).getType() != Xml.END_DOCUMENT) {

    String name = event.getName();

    int type = event.getType();
    if (type == Xml.END_TAG && name.equals("address")) {
    event = null;
    name = null;
    return;
    }
    event = parser.read();

    if (type != Xml.START_TAG) {

    event = null;
    continue;
    }
    ParseEvent next = parser.read();
    if (next.getType() != Xml.TEXT) {
    event = null;
    next = null;
    continue;
    }
    String text = next.getText();

    if(name.equals("Firstname")){
    vector.addElement(text);
    }
    List list = new List(" Conacts List", Choice.IMPLICIT);
    for(int i =0; i<vector.size(); i++){
    list.append(vector.elementAt(i).toString().trim(),null);
    }
    Display.getDisplay(this).setCurrent(list);

    System.err.println( name + ": " + text );

    event = null;
    text = null;
    next = null;
    }


    while parsing that i m getting above reported error "java.io.IOException: Curr. only CP0 supported." if i parse any simple wbxml file it parses and print the data correctly. ex
    xml file:
    <address_book>
    <info>
    <owner>Robert Cadena</owner>
    </info>
    <address>
    <name>Robert Cadena</name>
    <street_1>5555 Fake Street </street_1>
    <street_2>Suit 202</street_2>
    <city>Fake City</city>
    <state>CA</state>
    <zipcode>900099</zipcode>
    </address>
    <address>
    <name>Fake Name</name>
    <street_1>3232 Another Street </street_1>
    <city>Another City</city>
    <state>TX</state>
    <zipcode>79999</zipcode>
    </address>

    </address_book>

    wbxml:
    Jaddress_book info owner address name street_1 street_2 city state zipcode D 


    


    D
    



    DRobert Cadena 


    


    D


    D Robert Cadena 


    D%5555 Fake Street 


    D.Suit 202 


    D7Fake City 


    D<CA 


    DB900099 


    


    D


    D Fake Name 


    D%3232 Another Street 


    D7Another City 


    D<TX 


    DB79999 


    





    

    usage of namespace is posing some problem to parse for <sync> xml file?

    i m not able to create the tag_table, Attribute_table because i need to parse the wbxml data.

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    Sorry, still not get it: Who created the WBXML file? You or somebody else?

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    using the following code i created the wbxml file

    public byte[] getWBXMLStream(byte[] xmlData) { // xml to wbxml
    try {
    // Construct an InputStreamReader on ByterArrayInputStream.
    InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(xmlData));

    // Make parser using this Reader.
    XmlParser parser = new XmlParser(in);

    // Construct a DOM Document to parse XML.
    Document document = new Document ();
    document.parse(parser);
    in.close();

    // Make an OutputStream on which WbxmlWriter can write.
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    AbstractXmlWriter writer = new WbxmlWriter(out);
    document.write(writer);
    writer.close();

    // Get WBXML from this stream.
    xmlData = out.toString().getBytes();
    out.close();

    }//try
    catch (Exception e) { e.printStackTrace(); }
    return xmlData;
    }

    after converting using this i try to parse the wbxml file.

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    In WBXML world each XML tag (and attribute) name converts to an ID. Everything else like content can get an ID, too, or will be handeled in a global string table. WBXML per se had no support for namespaces except you code you ID mapping table very intelligent†, or create a WBXML in WBXML, or have the whole 2nd namespace in the global string table.

    I cannot help you further as you are not able to provide your XML->WBXML conversion routines to me. If this is all, then you have a problem which should be discussed in the kXML support channels. Years ago I used a org.kxml2.wap.WbxmlSerializer successfully.

    Are you working with kXML version 1? setTagTable is the key in both kXML 1 and 2.

    † Not very difficult actually, however, there is no dynamic namespaces as in XML. If you know all the namespace beforehand, then it is quite easy to contruct the tag mapping tables. For example each tag table is its own namespace or all tags in one table. When you have dynamic namespaces – you do not know all possible namespace before – than you have problems with WBXML.
    Last edited by traud; 2007-06-02 at 23:08.

  9. #9
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    Thanks for all your information.

    i want to know how to fetch/take the value present between the tags in wbxml file using kxml parser. because i will get respones from the server in wbxml format itself. so i need to parse the wbxml file to take the values present in it and store it in pim.

    i m using kxml.zip parser (kxml 1) . even i have kxml parser 2 also (kxml2-2.3.0.jar).

    all the code what i used were pasted in previous reply's. but again i tried with this code, i m successfully getting wbxml file in all those code, but i need to know how to parse the wbxml format to get the data in that.

    below find the another code with the output:

    /*
    * XmltagTable.java
    *
    * Created on June 4, 2007, 10:06 AM
    */

    import java.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import org.kxml.*;
    import org.kxml.io.*;
    import org.kxml.wap.*;
    /**
    *
    * @author ramyas
    * @version
    */
    public class XmltagTable extends MIDlet
    implements CommandListener {

    private Display display;

    public static final Command exitCommand =
    new Command( "Exit",
    Command.EXIT, 1 );

    public XmltagTable(){
    }

    public void commandAction( Command c,
    Displayable d ){
    if( c == exitCommand ){
    exitMIDlet();
    }
    }

    protected void destroyApp( boolean unconditional )
    throws MIDletStateChangeException {
    exitMIDlet();
    }

    public void exitMIDlet(){
    notifyDestroyed();
    }

    public Display getDisplay(){ return display; }

    protected void initMIDlet(){
    try {
    testXML();
    }
    catch( Exception e ){
    System.err.println( "Exception " + e );
    }

    exitMIDlet();
    }

    protected void pauseApp(){
    }

    protected void startApp()
    throws MIDletStateChangeException {
    if( display == null ){
    display = Display.getDisplay( this );
    initMIDlet();
    }
    }

    private void log( String str ){
    System.out.println( str );
    }

    // Write an XML document to the given writer

    private void writeXML( AbstractXmlWriter writer )
    throws IOException {
    writer.startTag( "Sync" );
    writer.startTag( "Collections" );
    writer.startTag( "Collection" );
    writer.startTag( "Class" );
    writer.write( "Contacts" );
    writer.endTag();
    writer.startTag( "SyncKey" );
    writer.write( "{6A374473-D63E-45FA-8556-129C8C1C3CFA}11" );
    writer.endTag();
    writer.startTag( "Status" );
    writer.write( "1" );
    writer.endTag();
    writer.startTag( "Commands" );
    writer.startTag( "Add" );
    writer.startTag( "ServerId" );
    writer.write( "rid:01c133474e27d04faba48d02078cf41d00000090e129" );
    writer.endTag();
    writer.startTag( "ApplicationData" );
    writer.startTag( "A:FileAs" );
    writer.write( "Mouse, Mickey" );
    writer.endTag();
    writer.startTag( "A:FirstName" );
    writer.write( "Mickey" );
    writer.endTag();
    writer.startTag( "A:LastName" );
    writer.write( "Mouse" );
    writer.endTag();
    writer.startTag( "A:BusinessPhoneNumber" );
    writer.write( "(425) 555-1212" );
    writer.endTag();
    writer.endTag();
    writer.endTag();
    writer.endTag();
    writer.endTag();
    writer.endTag();
    writer.endTag();
    writer.close();
    }

    private static final String tagTable[] = {
    "Sync",
    "Collections",
    "Collection",
    "Class",
    "SyncKey",
    "Status",
    "Commands",
    "Add",
    "ServerId",
    "ApplicationData",
    "A:FileAs",
    "A:FirstName",
    "A:LastName",
    "A:BusinessPhoneNumber"
    };


    private void testXML() throws IOException {
    log(
    "Writing uncompressed XML to a string...11" );

    ByteArrayOutputStream out =
    new ByteArrayOutputStream();
    XmlWriter xw = new XmlWriter(
    new OutputStreamWriter( out ) );
    writeXML( xw );

    String str = new String( out.toByteArray() );
    log( "String length is " + str.length() );
    log( "String value is given below is xml:" );
    log( str );

    log( "Writing compressed XML to a string..." );

    out = new ByteArrayOutputStream();
    WbxmlWriter bxw = new WbxmlWriter( out );
    bxw.setTagTable( 0, tagTable );
    writeXML( bxw );

    str = new String( out.toByteArray() );
    log( "String length is " + str.length() );
    log( "String value is wbxml" );
    log( str );

    log( "Done." );
    }
    }

    output:
    Writing uncompressed XML to a string...11
    String length is 567
    String value is given below is xml:



    <Sync>


    <Collections>


    <Collection>


    <Class>Contacts</Class>


    <SyncKey>{6A374473-D63E-45FA-8556-129C8C1C3CFA}11</SyncKey>


    <Status>1</Status>


    <Commands>


    <Add>


    <ServerId>rid:01c133474e27d04faba48d02078cf41d00000090e129</ServerId>


    <ApplicationData>


    <A:FileAs>Mouse, Mickey</A:FileAs>


    <A:FirstName>Mickey</A:FirstName>


    <A:LastName>Mouse</A:LastName>


    <A:BusinessPhoneNumber>(425) 555-1212</A:BusinessPhoneNumber>


    </ApplicationData>


    </Add>


    </Commands>


    </Collection>


    </Collections>


    </Sync>
    Writing compressed XML to a string...
    String length is 183
    String value is wbxml
     EFGHContacts I{6A374473-D63E-45FA-8556-129C8C1C3CFA}11 J1 KLMrid:01c133474e27d04faba48d02078cf41d00000090e129 NOMouse, Mickey PMickey QMouse R(425) 555-1212 
    Done.

    please help me to know HOW TO PARSE THE WBXML FILE in j2me midp
    Last edited by ramyashashe; 2007-06-04 at 08:09.

  10. #10
    Registered User
    Join Date
    Jun 2007
    Posts
    12

    Re: Parsing wbxml file to xml file using kxml parser

    my codes like the following ,but there is some wrong in it ,
    can you modify it?
    import java.io.*;

    import org.kxml.io.*;
    import org.kxml.kdom.*;
    import org.kxml.parser.*;
    import org.kxml.wap.*;

    public class Test2 {

    public byte[] getXMLStream( byte[] wbxmlData ) {
    try {
    // Construct an InputStream on byte[]
    // to be used by WbxmlParser.
    ByteArrayInputStream in = new ByteArrayInputStream(wbxmlData);
    AbstractXmlParser parser = new WbxmlParser(in);

    // Construct a DOM Document to parse WBXML.
    Document document = new Document ();
    document.parse(parser);
    in.close();

    // Make a Writer on which XmlWriter can write.
    CharArrayWriter out = new CharArrayWriter();
    AbstractXmlWriter writer = new XmlWriter(out);
    document.write(writer);
    writer.close();

    // Get XML byte[] from CharArrayWriter filled by XmlWriter.
    wbxmlData = out.toString().getBytes();
    out.close();

    }//try
    catch (Exception e) {e.printStackTrace();}
    return wbxmlData;
    }//getXMLStream


    public byte[] getWBXMLStream(byte[] xmlData) {
    try {
    // Construct an InputStreamReader on ByterArrayInputStream.
    InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(xmlData));

    // Make parser using this Reader.
    XmlParser parser = new XmlParser(in);

    // Construct a DOM Document to parse XML.
    Document document = new Document ();
    document.parse(parser);
    in.close();

    // Make an OutputStream on which WbxmlWriter can write.
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    AbstractXmlWriter writer = new WbxmlWriter(out);
    document.write(writer);
    writer.close();

    // Get WBXML from this stream.
    xmlData = out.toString().getBytes();
    out.close();

    }//try
    catch (Exception e) { e.printStackTrace(); }
    return xmlData;
    }//getWBXMLStream

    public static void main(String[] args)
    {
    byte[] buff = new byte[8272];
    // boolean cont = true;
    int emp,t=0;
    FileInputStream infile = null;

    try
    {
    infile = new FileInputStream("F:\\temp\\example.wbxml");
    }
    catch (FileNotFoundException e)
    {
    System.err.println("没有找到文件");
    System.exit(1);
    }

    try
    {

    while ((emp=infile.read())!=-1)
    {
    buff[t++]=(byte)emp;
    System.out.print((char)emp);
    }
    System.out.println("t="+t);


    } catch (Exception e)
    {
    e.printStackTrace();
    }


    try
    {
    infile.close();
    } catch (IOException e)
    {
    System.err.println("there is some wrong in file");
    System.exit(1);
    }

    Test2 b=new Test2();
    byte [] a = new byte[8272];
    a= b.getXMLStream(buff);
    System.out.println("the output");
    for(int i=0;i<a.length;i++)
    System.out.print((char)a[i]);
    // System.out.write(a,0,3272);
    }


    }

  11. #11
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    please help me to know HOW TO PARSE THE WBXML FILE in j2me midp using kxml parser.

  12. #12
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    As the answer is not that short, have you gone through the kXML documentation and examples already?

  13. #13
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    yes i have gone through the javadoc of kxml. for me the request and response will be in wbxml format, so i need to parse the wbxml file to take the data present in that.

    Wbxmlparser parser = new Wbxmlparser(wbxml file);
    parser.read(); //here the error throws
    please help me. thanks for ur information

  14. #14
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    No, I mean have you gone through the examples linked at kXML? Are you using the setTagTable method on your WbxmlParser object, too?

  15. #15
    Registered User
    Join Date
    May 2007
    Posts
    11

    Re: Parsing wbxml file to xml file using kxml parser

    Quote Originally Posted by traud
    No, I mean have you gone through the examples linked at kXML? Are you using the setTagTable method on your WbxmlParser object, too?
    i saw examples in kxml.zip file but they used some xmlpull.v1 parser most with kxml parser
    are you taking about this type of coding with tagtable, with this i am able to parse the wbxml file, below i pasted another file for that i need to parse

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;

    import org.kxml.*;
    import org.kxml.io.*;
    import org.kxml.kdom.*;
    import org.kxml.parser.*;
    import org.kxml.wap.*;


    // A simple MIDlet that shows how to use WBXML
    // encoding to "shrink" or "compress" XML documents.

    public class XMLCompressTest extends MIDlet
    implements CommandListener {

    private Display display;

    public static final Command exitCommand =
    new Command( "Exit",
    Command.EXIT, 1 );

    public XMLCompressTest(){
    }

    public void commandAction( Command c,
    Displayable d ){
    if( c == exitCommand ){
    exitMIDlet();
    }
    }

    protected void destroyApp( boolean unconditional )
    throws MIDletStateChangeException {
    exitMIDlet();
    }

    public void exitMIDlet(){
    notifyDestroyed();
    }

    public Display getDisplay(){ return display; }

    protected void initMIDlet(){
    try {
    testXML();
    }
    catch( Exception e ){
    System.err.println( "Exception " + e );
    }

    exitMIDlet();
    }

    protected void pauseApp(){
    }

    protected void startApp()
    throws MIDletStateChangeException {
    if( display == null ){
    display = Display.getDisplay( this );
    initMIDlet();
    }
    }

    private void log( String str ){
    System.out.println( str );
    }

    // Write an XML document to the given writer

    private void writeXML( AbstractXmlWriter writer )
    throws IOException {
    writer.startTag( "employee" );
    writer.startTag( "firstname" );
    writer.write( "Eric" );
    writer.endTag();
    writer.startTag( "lastname" );
    writer.write( "Giguere" );
    writer.endTag();
    writer.startTag( "sex" );
    writer.attribute( "type", "male" );
    writer.endTag();
    writer.startTag( "email" );
    writer.attribute( "valid", "true" );
    writer.attribute( "primary", "true" );
    writer.write( "ericgiguere@ericgiguere.com" );
    writer.endTag();
    writer.endTag();
    writer.close();
    }

    // Table for the tags in our DTD

    private static final String tagTable[] = {
    "employee",
    "firstname",
    "lastname",
    "sex",
    "email"
    };

    // Table for the attribute names in our DTD

    private static final String attrStartTable[] = {
    "type",
    "valid",
    "primary",
    };

    // Table for the attribute values in our DTD

    private static final String attrValueTable[] = {
    "true",
    "false",
    "male",
    "female"
    };

    // Show the difference in writing out the same
    // document using plain XML and then WBXML.

    private void testXML() throws IOException {
    log(
    "Writing uncompressed XML to a string..." );

    ByteArrayOutputStream out =
    new ByteArrayOutputStream();
    XmlWriter xw = new XmlWriter(
    new OutputStreamWriter( out ) );
    writeXML( xw );

    String str = new String( out.toByteArray() );
    log( "String length is " + str.length() );
    log( "String value is" );
    log( str );

    log( "Writing compressed XML to a string..." );

    out = new ByteArrayOutputStream();
    WbxmlWriter bxw = new WbxmlWriter( out );
    bxw.setTagTable( 0, tagTable );
    bxw.setAttrStartTable( 0, attrStartTable );
    bxw.setAttrValueTable( 0, attrValueTable );
    writeXML( bxw );

    str = new String( out.toByteArray() );
    log( "String length is " + str.length() );
    log( "String value is" );
    log( str );
    log( "Done." );

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());

    String sstr = new String( out.toByteArray() );
    log(" in parser "+ sstr );

    WbxmlParser parser = new WbxmlParser(in);
    parser.setTagTable( 0, tagTable );
    ParseEvent event = null;
    boolean flag = true;
    while(flag){
    event = parser.read();
    if(event.getType() == Xml.START_TAG){
    String s = event.getName();
    log(" jjjjjjjj" + s);
    if(s.equals("firstname")){
    event = parser.read();
    String txt = event.getText();
    log(" iiiiiiiii" +txt );
    }
    }
    else if(event.getType() == Xml.END_TAG){
    flag = false;
    }
    }
    }
    }


    but i need to parse below file which is in wbxml format

    <?xml version="1.0" encoding="utf-8"?>
    <Sync xmlns="AirSync:" xmlns:A="POOMCONTACTS:">
    <Collections>
    <Collection>
    <Class>Contacts</Class>
    <SyncKey>{6A374473-D63E-45FA-8556-129C8C1C3CFA}11</SyncKey>
    <Status>1</Status>
    <Commands>
    <Add>
    <ServerId>rid:01c133474e27d04faba48d02078cf41d00000090e129
    </ServerId>
    <ApplicationData>
    <A:FileAs>Mouse, Mickey</A:FileAs>
    <A:FirstName>Mickey</A:FirstName>
    <A:LastName>Mouse</A:LastName>
    <A:BusinessPhoneNumber>(425) 555-1212</A:BusinessPhoneNumber>
    </ApplicationData>
    </Add>
    </Commands>
    </Collection>
    </Collections>
    </Sync>

    how to process with namespace

    startTag(PrefixMap prefixMap,java.lang.String namespace,java.lang.String name)
    <Sync xmlns="AirSync:" xmlns:A="POOMCONTACTS:">

    please help me in this regard.

Similar Threads

  1. XML Parser in C++
    By mrinal_malhotra in forum Symbian
    Replies: 4
    Last Post: 2008-11-10, 13:22
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. XML parsing problem in Nokia 12
    By codekiller in forum Nokia M2M
    Replies: 2
    Last Post: 2005-04-26, 09:01
  4. Replies: 0
    Last Post: 2002-06-10, 12:24
  5. XML parsing
    By Nokia_Archive in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-05-31, 19:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •