Hi Dale,

Dale Worley <[EMAIL PROTECTED]> writes:

> I'm dealing with a similar problem -- the XML is known to be in a
> particular namespace, but the root element does not have an XML
> namespace declaration.  I've got an .xsd file containing the schema for
> the namespace.
>
> Given that the underlying parser has a way of inheriting the default
> namespace from an element to its children, it seems like there must be a
> way of setting the "your default namespace" for the root element of the
> XML to be parsed.

Your XML document is invalid per your schema. If Xerces provided ways
to "work around" invalid documents, it would be hard to decide where
to stop. For example, if some broken system produced tag names in all
capital while the schema says they should be lower case, should there
be a feature to "handle" this?

The way I would handle your situation is like this: I would create
my own, vocabulary-specific input source which would detect root
elements without namespaces and "fix" them by injecting the missing
namespace declaration into the output. Because this all happens at
the root element level, the code should be pretty simple.

Boris

-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding

Reply via email to