Results 1 to 2 of 2

Thread: xml parser java

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default xml parser java

    Hello, I write a file xml from same data woth this way:
    Qt Code:
    1. out.write("<tag attt=\""number\">");
    2. out.write( content );
    3. out.write("</tag>");
    4. .........................................
    To copy to clipboard, switch view to plain text mode 

    Now, sometimes code is (I notice it only now):
    align=center><FONT
    so I have it as text in a node. And it is ok. But when I read that xml (using this libraries in java)
    Qt Code:
    1. import javax.xml.parsers.DocumentBuilder;
    2. import javax.xml.parsers.DocumentBuilderFactory;
    3. import org.w3c.dom.Document;
    4. import org.w3c.dom.Element;
    5. import org.w3c.dom.NamedNodeMap;
    6. import org.w3c.dom.Node;
    7. import org.w3c.dom.NodeList;
    To copy to clipboard, switch view to plain text mode 
    the parser crash saying that
    Element type "FONT" must be followed by either attribute specifications, ">" or "/>".
    I need: or detect this strange content while I write the xml and discard it, or use a parser that permit that as text.

    Hope it is clear, thanks,
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: xml parser java

    You have to substitute all opening angle brackets in the text by "&lt;" or use a CDATA section to escape possible special characters.

Similar Threads

  1. java parser
    By mickey in forum General Programming
    Replies: 13
    Last Post: 14th October 2008, 22:11
  2. Integrate Qt C++ with Java jars
    By nicksnels in forum Qt Programming
    Replies: 4
    Last Post: 6th March 2008, 08:10
  3. Qt4 open src mingw from a PC to another
    By nvictor in forum Installation and Deployment
    Replies: 11
    Last Post: 1st May 2007, 17:41
  4. Parser in Qt.... HELP!
    By deepusrp in forum Newbie
    Replies: 6
    Last Post: 23rd January 2007, 21:18
  5. Embedding Java in Qt
    By learnerplts in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2006, 15:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.