Just to be clear it is the element's value [1] which is defaulted not the element itself. If you were expecting the validator to insert elements which were absent from the input that's not how schema works. I tried the test on that bug report and it works for me. If Bugzilla #5891 was a bug in 2.0.0 it was fixed a long time ago. FYI: Xerces now uses JIRA to track bug reports; the Bugzilla issue you found is now JIRA issue XERCESJ-122 [2].
Thanks. [1] http://www.w3.org/TR/xmlschema-1/#sic-eltDefault [2] http://issues.apache.org/jira/browse/XERCESJ-122 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Decoker, Lydie \(Lydie\)" <[EMAIL PROTECTED]> wrote on 09/19/2006 07:19:31 AM: > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
