Hey,

Boris is correct here. The problem is we just don't know about them. You could serialize to an in mem buffer and then parse/validate it, then you would get them.

Cheers,

Gareth

[EMAIL PROTECTED] wrote:
The DOM specification says this about createElement
(http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-2141741547)

Creates an element of the type specified. Note that the instance
returned implements the Element interface, so attributes can be
specified directly on the returned object.
In addition, if there are known attributes with default values, Attr
nodes representing them are automatically created and attached to the
element.

I believe this means that the default attribute nodes should be
created in the createNode implementation. Or am I misunderstanding the
spec?

On 5/3/06, Boris Kolpackov <[EMAIL PROTECTED]> wrote:


[EMAIL PROTECTED] writes:

> If I load an XML document from disk and that document has a DTD
> reference, then my EntityResolver is used to locate the DTD. When I
> ask for an attribute that doesn't exist in the XML file I correctly
> get the default value specified in the DTD.
>
> I'd like the same thing to happen for newly created documents. I am
> using DOMImplementation::createDocumentType(X("myxml"), X(""),
> X("myxml.dtd")); and the document correctly contains the DOCTYPE entry
> but when I ask for the same attribute I'm getting nil instead of the
> default value in the DTD.

In order for this to work the document needs to be validated
"on-the-fly", as you create it. This is necessary in order to
associate schema (DTD or XML Schema) definitions with document
nodes so that when you ask for an attribute that does not
exist, the default attribute set and their values could be
consulted.

I don't think this is supported simply because if it were, we
would have also had in-memory validation, which is definitely
not supported.


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




--
Gareth Reakes, Managing Director           Embrace Mobile
+44-1865-811197              http://www.embracemobile.com

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

Reply via email to