I'm building a Document using Xerces2.0.0 with a DocumentBuilder. I want
the resultant document to have the proper attributes for XML schema
location, namespace, etc. Not knowing any other way to do it, I'm just
calling setAttribute on the root Element for "xmlns", "xmlns:xsi" and
"xsi:schemaLocation". (Is there a better way?)

I then serialize it out to a file using XmlSerializer.  Everything is fine,
but an empty
xmlns="" shows up on every child element of the root node. Elements deeper
than that don't have it, just the direct children.

The DocumentBuilder instance is created from a DocumentBuilderFactory with
the following attributes set:

            factory.setValidating(validation);
            factory.setNamespaceAware(true);
            factory.setAttribute
("http://apache.org/xml/features/validation/schema";, new Boolean(true));
            factory.setAttribute
("http://apache.org/xml/features/validation/schema-full-checking";, new
Boolean(true));
            factory.setAttribute
("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
"http://www.w3.org/2001/XMLSchema";);
            factory.setIgnoringElementContentWhitespace(true);

I've also tried omitting these, or some of these, and it doesnt seem to
make a difference. Can anyone explain why this is happening?

Thanks,

Eric Schwarzenbach


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to