XML parser patterns

Magnus Heino

Usenet Archive
Joined
Jun 8, 2004
Messages
1
Reaction score
0
Hi.

Are there any patterns or other design techniques that could be used when implementing a xml parser that needs to be able to handle different versions of a schema?

Let's say that I write a xml parser that can parse xhtml 1.0. Now I want it to be able to handle both xhtml 1.0 and xhtml 1.1. How should I design my application?

Thanks,

/Magnus
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
Magnus said:
Are there any patterns or other design techniques that could be used when implementing a xml parser that needs to be able to handle different versions of a schema?

Let's say that I write a xml parser that can parse xhtml 1.0. Now I want it to be able to handle both xhtml 1.0 and xhtml 1.1. How should I design my application?

A nonvalidating parser only needs to check for well-formedness and should therefore be able to parse any XML language, whether that is XTHML 1.0 or XHTML 1.1 or SVG. Even a validating parser should be able to validate against any DTD and/or XML schema and not just parse against the DTD for for instance XHTML 1.0 strict. That is the whole reason to have a meta language XML as an extensible markup language so that parsers can be written for XML in general and not one for each XML language/application someone comes up with. I am not a parser developer however and we do not have many questions on such topics here, maybe the list http://xml.org/xml/xmldev.shtml is a better place to get answers from developers and implementers
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
Magnus Heino said:
Let's say that I write a xml parser that can parse xhtml 1.0.

That's not how it's usually done.

You write a parser that can parse *any* well-formed XML, and then you write a validation layer on top of it that checks that the elements and attributes conform to the DTD or schema.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top