![]() |
Find Opening and Closing tags in a XML file
Hi All,
Is there any method to find the matching and closing tags in a XML file? If some of tags are not closed properly, then it should be display like missing tags. If any tool or exe file, kindly let me know, as I am in critical situation. Regards, Eric |
Re: Find Opening and Closing tags in a XML file
On 30/09/10 18:12, Saravan Wants wrote:
> Hi All, > > Is there any method to find the matching and closing tags in a XML > file? Yes, it's called a parser. It checks the syntax of the document and reports on any missing or badly-formed bits. All XML editors contain a parser, so if you open the document in an XML editor it should check it and report the errors. > If some of tags are not closed properly, then it should be > display like missing tags. If any tool or exe file, kindly let me > know, as I am in critical situation. Hundreds. See the FAQ at http://xml.silmaril.ie/authors/parsers/ Two very reliable free stand-alone ones are onsgmls (part of the OpenSP/OpenJade packages at http://openjade.sourceforge.net/), and RXP (http://www.cogsci.ed.ac.uk/~richard/rxp.html). Virtually every computing science student on the planet has had to write an XML parser at some stage by now, I guess. There are also lots of commercial parsers, but they tend to be embedded inside editors and other software. ///Peter -- XML FAQ: http://xml.silmaril.ie/ |
Re: Find Opening and Closing tags in a XML file
On 9/30/2010 1:12 PM, Saravan Wants wrote:
> If some of tags are not closed properly, then it should be > display like missing tags. What does "display like missing tags" mean in this context? Most XML parsers will not tolerate ill-formed XML, including those with "tags" that are not properly balanced. The main exception I know is the Tidy tool -- available from the W3C's website, among other places -- which can be told to make a "best guess" at repairing broken documents, much as browsers tend to for broken HTML. -- Joe Kesselman, http://www.love-song-productions.com...lam/index.html {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" -- /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt." |
Re: Find Opening and Closing tags in a XML file
On 30/09/10 21:09, Joe Kesselman wrote:
> On 9/30/2010 1:12 PM, Saravan Wants wrote: >> If some of tags are not closed properly, then it should be >> display like missing tags. > > What does "display like missing tags" mean in this context? I think he means "show where there are elements with missing end-tags", ie indicate instances of non-well-formedness. It's sometimes amusing to confront people with fully valid HTML :-) <!doctype html public "-//IETF//DTD HTML//EN"> <title>My first web page</title> <h1>Welcome to my site</h1> <p>This is my web site. > Most XML parsers will not tolerate ill-formed XML, including those with > "tags" that are not properly balanced. The main exception I know is the > Tidy tool -- available from the W3C's website, among other places -- > which can be told to make a "best guess" at repairing broken documents, > much as browsers tend to for broken HTML. I came across a badly broken HTML instance the other day which broke even Tidy. It was a page containing text copied and pasted from some other source, probably an old version of word, and the chunk started something like: <div> </p><p font: Verdana>text... .... </div> The div was generated, but the user's pasted text started with a p end-tag, and Tidy gagged mightily on it, causing Cocoon to emit an empty page. Quite apart from the invalid and unquoted "attributes", I've never seen a chunk pasted from a GUI *start* with an end-tag. ///Peter |
| All times are GMT. The time now is 11:03 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.