Bugs item #2432779, was opened at 2008-12-16 08:29
Message generated for change (Comment added) made by szegedia
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: Attila Szegedi (szegedia)
Date: 2009-06-24 09:20

Message:
This is possibly related to the other bug I filed yesterday, which also
breaks XSLT when there's a top-level comment:
<https://sourceforge.net/tracker/index.php?func=detail&aid=2810839&group_id=16035&atid=116035>

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

Comment By: Stepan Koltsov (yozh)
Date: 2009-03-18 09:04

Message:
Please, fix the bug. It is trivial, but important.

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

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

Message:
Updating priority

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

Comment By: bphilipnyc (bphilipnyc)
Date: 2008-12-16 08: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

------------------------------------------------------------------------------
_______________________________________________
dom4j-dev mailing list
dom4j-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to