XML parser patterns

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Magnus Heino

    #1

    XML parser patterns

    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

    #2
    Re: XML parser patterns



    Magnus Heino wrote:
    [color=blue]
    > 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?[/color]

    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

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Richard Tobin

      #3
      Re: XML parser patterns

      In article <d300da79.04060 80459.6771b631@ posting.google. com>,
      Magnus Heino <magnus.heino@h ome.se> wrote:
      [color=blue]
      >Let's say that I write a xml parser that can parse xhtml 1.0.[/color]

      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

      Comment

      Working...