axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <>
Subject Re: [Axis2] Integrating Complete XML infoset support
Date Fri, 24 Jun 2005 04:07:32 GMT
Sanjiva Weerawarana wrote:

>On Thu, 2005-06-23 at 13:20 +0530, jayachandra wrote:
>>Now this is left for the community to thoroughly discuss how we will
>>support full infoset. FYI, earlier before the release of M2 I worked
>>on this and found that making OMDocument extend OMElementImpl would
>>complement the lacking functionalities like child API, serialization
>>functionality etc. for OMDocument, without disturbing any of existing
>>code base.
>>Yeah, the above fix gives the impression that OMDocument ISA OMElement
>>and that might not be correct. But if we all can churn and come out
>>with a better design I can use that to re-implement the infoset
>>support, as much as I can.
>This is how its done in most DOM impls too .. in fact IIRC Xerces DOM
>impl doesn't even complain if you add multiple child elements to the
>Document node! That's ok; that's a programmer error anyway :).
>So +1 for making OmDocument extend OmElement.

why to do this *if* it can be done correctly and have API safeguards 
against stupid mistake (what about horrors like OMDocument added inside 
another OMElement ...)?

this is really not that difficult to get right - i did it in XPP3/5 and 
it worked out just fine - children management function make sure that 
only allowed content (comments, PIs etc) is inserted and there are 
accessors for all content (see interface below).


package org.xmlpull.v1.builder;

 * Represents
 * <a 
Information Item</a>
 * .
 * @version $Revision: 1.5 $
 * @author <a href="">Aleksander 
public interface XmlDocument extends XmlContainer, Cloneable
    //JDK15 covariant public XmlDocument clone() throws 
    public Object clone() throws CloneNotSupportedException;
     * An ordered list of child information items, in document order.
     * The list contains exactly one element information item.
     * The list also contains one processing instruction information item
     * for each processing instruction outside the document element,
     * and one comment information item for each comment outside the 
document element.
     * Processing instructions and comments within the DTD are excluded.
     * If there is a document type declaration,
     * the list also contains a document type declaration information item.
    public Iterable children();
    public XmlElement getDocumentElement();
    public XmlElement requiredElement(XmlNamespace n, String name);
    public XmlElement element(XmlNamespace n, String name);
    public XmlElement element(XmlNamespace n, String name, boolean create);
     * An unordered set of notation information items,
     * one for each notation declared in the DTD.
    public Iterable notations();
     * An unordered set of unparsed entity information items,
     * one for each unparsed entity declared in the DTD.
    public Iterable unparsedEntities();
    public String getBaseUri();
    public String getCharacterEncodingScheme();
    public void setCharacterEncodingScheme(String characterEncoding);
    public Boolean isStandalone();
    public String getVersion();
    public boolean isAllDeclarationsProcessed();
    // manipulate children
    public void setDocumentElement(XmlElement rootElement);
    public void addChild(Object child);
    public void insertChild(int pos, Object child);
    public void removeAllChildren();
    public XmlComment newComment(String content);
    public XmlComment addComment(String content);
    public XmlDoctype newDoctype(String systemIdentifier, String 
    public XmlDoctype addDoctype(String systemIdentifier, String 
    //public XmlElement newDocumentElement(String name);
    public XmlElement addDocumentElement(String name);
    public XmlElement addDocumentElement(XmlNamespace namespace, String 
    public XmlProcessingInstruction newProcessingInstruction(String 
target, String content);
    public XmlProcessingInstruction addProcessingInstruction(String 
target, String content);
    // manipulate unparsed entities
    public void removeAllUnparsedEntities();
    // manipulate notations
    public XmlNotation addNotation(String name,
                                   String systemIdentifier,
                                   String publicIdentifier,
                                   String declarationBaseUri);
    public void removeAllNotations();

The best way to predict the future is to invent it - Alan Kay

View raw message