XML Parser crashing while encountering escape entities


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: XML Parser crashing while encountering escape entities

  1. #1
    Join Date
    Feb 2009
    Posts
    2

    XML Parser crashing while encountering escape entities

    I'm building an application which uses JAXP to parse XML documents.The XML document which is being parsed contains escape characters "&" and parser throws exception with a message."The entity "sect" was referenced but not declared.".XML document doesn't contain a DTD reference and we can't edit the XML file.Could anyone please suggest a way to handle this problem.
    Thanks in advance,
    anand-abhishek

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Welcome to DevX

    If your XML document contains external entity references, and there is no DTD declaration in the XML then it will be very difficult or impossible to parse. It isn't well formed.

    Here is an example of something that isn't well formed, and will give you major headaches in trying to parse (even if you actually do wind up being able to parse it)
    Code:
    <SampleXML>
         &anand-abhishek;
    </SampleXML>
    However, if you add a DTD reference to the XML document then you are in business.
    Code:
    <!DOCTYPE SampleXML SYSTEM "http://www.123456.com/SampleXML.dtd">
    <SampleXML>
         &anand-abhishek;
    </SampleXML>
    Am I making sense?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Feb 2009
    Posts
    2
    Thanks 4 ur reply.Could you please give us an idea of how can we insert a DTD stub in the file at run time?Please reply and thanks in advance.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    I don't believe you can add a DTD stub at run time. At least, I don't know how.

    That would have to be done through code, in design time.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Try XML Junction
    By Tim in forum xml.announcements
    Replies: 0
    Last Post: 10-11-2001, 05:00 PM
  2. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 05:07 AM
  3. Data Junction Announces XML Junction 7.51
    By Tim Frost in forum xml.announcements
    Replies: 0
    Last Post: 04-02-2001, 11:53 AM
  4. Check out Turbo XML: Free trial download
    By Extensibility in forum web.announcements
    Replies: 0
    Last Post: 07-20-2000, 07:20 PM
  5. Check out Turbo XML
    By Sales in forum xml.announcements
    Replies: 0
    Last Post: 07-20-2000, 07:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center