[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [SAX] Looking for the missing event
hi, when I try this : try { TransformerHandler th = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler(); StringWriter sw = new StringWriter(); th.setResult(new StreamResult( sw ) ); SAXParser sp = SAXParserFactory.newInstance().newSAXParser(); System.out.println( sp.getClass().getName() ); XMLReader reader = sp.getXMLReader(); System.out.println( reader.getClass().getName() ); reader.setContentHandler( th ); reader.setDTDHandler( th ); reader.setProperty( XMLNames.LEXICAL_HANDLER_SAX_PROPERTY, th ); String xml = "<?xml version=\"1.0\"?>" + "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"+ "<plist version=\"1.0\"/>"; reader.parse( new InputSource( new StringReader( xml ) ) ); System.out.println( sw ); } catch ( Exception e ) { e.printStackTrace(); fail( e.toString() + " shouldn't be thrown."); } ...I get this : org.apache.xerces.jaxp.SAXParserImpl org.apache.xerces.parsers.SAXParser <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"<!--- Primitive types --><!-- Contents interpreted as Base-64 encoded --><!-- Contents should conform to a subset of ISO 8601 (in particular, YYYY '-' MM '-' DD 'T' HH ':' MM ':' SS 'Z'. Smaller units may be omitted with a loss of precision) --><!-- Numerical primitives --><!-- Boolean constant true --><!-- Boolean constant false --><!-- Contents should represent a floating point number matching ("+" | "-")? d+ ("."d*)? ("E" ("+" | "-") d+)? where d is a digit 0-9. --><!-- Contents should represent a (possibly signed) integer number in base 10 -->> <plist version="1.0"/> the external DTD contains some XML comments that are reported in the output ; the formatted result is incorrect : <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"<!--- Primitive types instead of : <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" [<!--- Primitive types or even rather : <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> The correct output should be the last, but I'm not sure that the serializer can distinguish a comment that occurs in the internal subset from a comment that occurs in the external subset : there aren't such events, particularly if we look at TRAX (javax.xml.transform.sax.TransformerHandler) and even if we also consider org.xml.sax.ext.DeclHandler Is there a workaround ? Did I miss something ? -- Cordialement, /// (. .) --------ooO--(_)--Ooo-------- | Philippe Poulard | ----------------------------- http://reflex.gforge.inria.fr/ Have the RefleX !
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|