Hello, everyone:
I'm getting an error when validating an XML document
from a file that was saved to the file system using
OutputFormat, whereas no error occurs when it's saved
with a transformation.
Here's the full text of the error message:
------------------------------------------
java.lang.Exception: s4s-elt-character: Non-whitespace
characters are not allowed in schema elements other
than 'xs:appinfo' and 'xs:documentation'. Saw '>'.
The XML document was saved with this code:
------------------------------------------
OutputFormat format = new OutputFormat(doc);
XMLSerializer serializer = new XMLSerializer(out,
format);
serializer.setNamespaces(true);
serializer.serialize(doc);
However, when the XML document is saved with the
following code, the document validates successfully:
--------------------------------------------
StreamResult result = new StreamResult(xml);
TransformerFactory tFactory =
TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.transform(new DOMSource(doc), result);
btw: The XML document was originally generated via
an XSL stylesheet that contains the following:
disable-output-escaping="yes"
Has anyone else has encountered this type of error?
Suggestions welcome...
Regards,
Oswald