Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLDocumentBuilder and default attribute values

843834Nov 4 2001 — edited Nov 5 2001
I'm building an XMLdocument like this:
String s ="<?xml version=\"1.0\" standalone=\"no\"?>";
s +="<!DOCTYPE MyRootElement";
s += "SYSTEM "\file:./mydtd.dtd\">";
s += "<MyRootElement>";

Parser parser = new Parser();

XmlDocumentBuilder builder = new XmlDocumentBuilder();

builder.setDisableNamespaces(false);

builder.setParser(parser);

InputSource input = new InputSource(new StringReader(s));

parser.parse(input);
XMLDocument myDoc = builder.getDocument();

This works fine except the attributes aren't set according to their default values.
eg:
If i have an attribute specified in the dtd like this;
type (a|b|c|d) "c"

The attribute has a value of 'a' in myDoc .
Has anyone got any ideas why? Please.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2001
Added on Nov 4 2001
3 comments
128 views