Bugs item #2432779, was opened at 2008-12-16 01:29
Message generated for change (Comment added) made by bphilipnyc
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=2432779&group_id=16035

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
>Priority: 3
Private: No
Submitted By: bphilipnyc (bphilipnyc)
Assigned to: Nobody/Anonymous (nobody)
Summary: STAXEventReader does not support XML comments

Initial Comment:
I was trying to reader an XML file with XML-style comments at the top of the 
file, but got an XMLStreamException indicating that the event is unsupported.  
Here was my fix to STAXEventReader (commented out below).  Please let me know 
whether there is a better alternative or whether you see pitfalls with this.

This is my first post, btw :)

Thanks,
Biju


public Node readNode(XMLEventReader reader) throws XMLStreamException {
        XMLEvent event = reader.peek();

        if (event.isStartElement()) {
            return readElement(reader);
        } else if (event.isCharacters()) {
            return readCharacters(reader);
        } else if (event.isStartDocument()) {
            return readDocument(reader);
        } else if (event.isProcessingInstruction()) {
            return readProcessingInstruction(reader);
        } else if (event.isEntityReference()) {
            return readEntityReference(reader);
        } else if (event.isAttribute()) {
            return readAttribute(reader);
        } else if (event.isNamespace()) {
            return readNamespace(reader);
//      } else if (event.getEventType() == 
javax.xml.stream.XMLStreamConstants.COMMENT) {
//          return readComment(reader);
        } else {
            throw new XMLStreamException("Unsupported event: " + event);
        }
    }    


----------------------------------------------------------------------

>Comment By: bphilipnyc (bphilipnyc)
Date: 2008-12-16 01:38

Message:
Updating priority

----------------------------------------------------------------------

Comment By: bphilipnyc (bphilipnyc)
Date: 2008-12-16 01:36

Message:
Sorry, that first line should read: "I was trying to read an XML file..."

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=2432779&group_id=16035

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to