re PR xml/30831 (Writing (transforming) XML fails)

2007-03-09  Gary Benson  <gbenson@redhat.com>
	    Chris Burdess  <dog@gnu.org>

	PR classpath/30831
	* gnu/xml/dom/ls/SAXEventSink.java: Only set extended document
	properties when reader is available.


Co-Authored-By: Chris Burdess <dog@gnu.org>

From-SVN: r122743
This commit is contained in:
Gary Benson
2007-03-09 09:31:18 +00:00
committed by Gary Benson
parent bff4b63d31
commit 8e4425d798
3 changed files with 34 additions and 24 deletions
@@ -144,37 +144,40 @@ public class SAXEventSink
final String PROPERTIES = "http://xml.org/sax/properties/";
final String GNU_PROPERTIES = "http://gnu.org/sax/properties/";
boolean standalone = reader.getFeature(FEATURES + "is-standalone");
doc.setXmlStandalone(standalone);
try
{
String version = (String) reader.getProperty(PROPERTIES +
"document-xml-version");
doc.setXmlVersion(version);
}
catch (SAXNotRecognizedException e)
{
}
catch (SAXNotSupportedException e)
if (reader != null)
{
boolean standalone = reader.getFeature(FEATURES + "is-standalone");
doc.setXmlStandalone(standalone);
try
{
String version = (String) reader.getProperty(PROPERTIES +
"document-xml-version");
doc.setXmlVersion(version);
}
catch (SAXNotRecognizedException e)
{
}
catch (SAXNotSupportedException e)
{
}
try
{
String encoding = (String) reader.getProperty(GNU_PROPERTIES +
"document-xml-encoding");
doc.setXmlEncoding(encoding);
}
catch (SAXNotRecognizedException e)
{
}
catch (SAXNotSupportedException e)
{
}
}
if (locator != null && locator instanceof Locator2)
{
String encoding = ((Locator2) locator).getEncoding();
doc.setInputEncoding(encoding);
}
try
{
String encoding = (String) reader.getProperty(GNU_PROPERTIES +
"document-xml-encoding");
doc.setXmlEncoding(encoding);
}
catch (SAXNotRecognizedException e)
{
}
catch (SAXNotSupportedException e)
{
}
}
public void endDocument()