Joseph Kesselman <[EMAIL PROTECTED]> writes:

I wrote an GUI application which allows (allegedly) to read an
existing XML doc into it, displays in a scroll panel a JTree
representation, where they can arrow up/down.  A different panel
contains a bunch of JComponents which display, and allow editting of
the content.  They can change things, then update the document, and
then serialize it.  An example of the file is as follows:

,----[ sample.xml ]
| <?xml version="1.0" encoding="UTF-8"?>
| <database>
| 
|   <element>
|     <name>UPC</name>
|     <component>NUM_SHORT</component>
|     <type>byte</type>
|     <editable>false</editable>
|     <required>true</required>
|     <packed>true</packed>
|     <bitfield>false</bitfield>
|     <key>true</key>
|     <textFont>Courier New</textFont>
|     <textSize>12</textSize>
|     <dataFont>Default</dataFont>
|     <dataSize>12</dataSize>
|     <databaseName>itemcode</databaseName>
|     <length>6</length>
|   </element>
| 
|   <element>
|     <name>Department</name>
|     <component>TEXT</component>
|     <type>char</type>
|     <editable>true</editable>
|     <required>false</required>
|     <packed>true</packed>
|     <bitfield>false</bitfield>
|     <key>false</key>
|     <textFont>Courier New</textFont>
|     <textSize>12</textSize>
|     <dataFont>Default</dataFont>
|     <dataSize>2</dataSize>
|     <databaseName>departme</databaseName>
|     <length>4</length>
|   </element>
| 
| </database>
`----

I have a button ('New') which was intended to insert a new 'element'
node to the tree.  Are you saying this isn't possible?

> According to DOM Level 2, you can not actually insert or remove the root
> element of a Document; it must be created at the same time as the Document
> node (see the DOMImplementation.createDocument method). This is tied into
> the fact that in some DOMs, both the DTD/schema and the namespaced name of
> the root element may actually change which classes are instantiated by this
> factory.
>
> (Note that DOM Level 1 had no createDocument method -- everyone was using
> their own custom APIs for the purpose.)
>
>
>
> DOM Level 3 is currently planning to allow implementations to relax this
> requirement, by allowing a Document to be created without a root element.
> In this special case, it will be permissible to create and insert a root
> element... but you may not get the same DOM implementation classes that you
> would have if you'd done it all as a single createDocument operation.
>
> (Note that null was made an explicitly permitted argument value in
> http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030609/core.html#Level-2-Core-DOM-createDocument)
>
>
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Thanks,
Jeff
,----
| Jeffery B. Rancier
| 
| Softechnics
| a METTLER TOLEDO company
`----


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

Reply via email to