Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   Find Opening and Closing tags in a XML file (http://www.velocityreviews.com/forums/t734456-find-opening-and-closing-tags-in-a-xml-file.html)

Saravan Wants 09-30-2010 05:12 PM

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

Peter Flynn 09-30-2010 06:57 PM

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/

Joe Kesselman 09-30-2010 08:09 PM

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."

Peter Flynn 09-30-2010 09:33 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57