DOOM doesn't correctly enforce hierarchy constraints on Document
----------------------------------------------------------------

                 Key: WSCOMMONS-423
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-423
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
            Reporter: Andreas Veithen
            Assignee: Andreas Veithen
            Priority: Minor


According to "Document Object Model (DOM) Level 3 Core Specification", section 
1.1.1, the children that are allowed for a Document node are:

Element (maximum of one), ProcessingInstruction, Comment, DocumentType (maximum 
of one)

It can be seen that Text nodes are not allowed as children of a Document node. 
However, currently DOOM's DocumentImpl only enforces this particular constraint 
if the Document already has an Element child.

In addition, StAXOMBuilder will request OMDOMFactory to create text nodes at 
document level. This leads to the following situation:
1) Whitespace appearing between a comment and the document element will result 
in an invalid DOM hierarchy, with a Text node as child of Document.
2) Whitespace appearing after the document element will cause a parsing error. 
Note that this only happens when the client code requests the next sibling of 
the document element, which is very often not the case.

To solve this we need a clean way to let StAXOMBuilder discard nodes that are 
valid in the XML infoset, but that are not allowed (or not representable) by 
the particular OM implementation. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to