Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Find Opening and Closing tags in a XML file

Reply
Thread Tools

Find Opening and Closing tags in a XML file

 
 
Saravan Wants
Guest
Posts: n/a
 
      09-30-2010
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
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      09-30-2010
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/
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      09-30-2010
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."
 
Reply With Quote
 
Peter Flynn
Guest
Posts: n/a
 
      09-30-2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
content is not allowed between the opening and closing tags steve@thepinksofa.com ASP .Net 2 04-15-2007 12:39 AM
Validate opening and closing of html tags Pradeep Java 8 04-18-2006 01:27 PM
Error: Content is not allowed between the opening and closing tags for element Allan Ebdrup ASP .Net 0 01-26-2006 08:45 AM
Error: Content is not allowed between the opening and closing tags for element Allan Ebdrup ASP .Net Web Controls 0 01-20-2006 09:01 AM
RegEx to find CFML tags nested in HTML tags Dean H. Saxe Perl 0 01-03-2004 06:11 PM



Advertisments