I have found here that in 2002, there was the same issue with Xerces
2.0.0 beta 4

http://issues.apache.org/bugzilla/show_bug.cgi?id=5891 

I did the test with default attributes, it's working. So it seems I am
facing exactly the same issue 4 years later :o(
 

-----Original Message-----
From: Decoker, Lydie (Lydie) [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 19, 2006 11:56
To: [email protected]
Subject: Default attributes and elements

How to add in the DOM tree the default attributes and elements?

What I did is the following:

// Set the DocumentBuilderFactory system property
System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apach
e.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.validation.SchemaFactory:http://www.w3.org
/2001/XMLSchema", "org.apache.xerces.jaxp.validation.XMLSchemaFactory");

// Create the dom factory
DocumentBuilderFactory domFactory=DocumentBuilderFactory.newInstance();
System.out.println("Document builder factory class: " +
domFactory.getClass().getName());
        
// Set the namespace property
domFactory.setNamespaceAware(true);
        
// Set the validation property
domFactory.setValidating(true);
        
// Set the schema language property to be used for validation
domFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaL
anguage", XMLConstants.W3C_XML_SCHEMA_NS_URI);=09
        
// Specify the XML schema document to be used for validation
domFactory.setAttribute(JMSValidator.JAXP_SCHEMA_SOURCE, new
File(schemaLocation));
domFactory.setAttribute("http://xml.org/sax/features/validation";, true);
domFactory.setAttribute("http://apache.org/xml/features/validation/schem
a", true);
domFactory.setAttribute("http://apache.org/xml/features/validation/schem
a/element-default",true);

But when printing out the "augmented" document, the default values were
not added.
Any help would be appreciated.

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


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

Reply via email to