Hi,
 
I have following problem:
 
I have xml file with some data:
 
<?xml version="1.0" encoding="UTF-16"?>
<?xml-stylesheet type="text/xsl" href="example.xsl" ?>
<data>
  <block>
     Hello World
  </block>
</data>
 
I have a xsl file that needs to transform the xml data to another xml format compliant with the test.dtd specification:
 
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"  doctype-system="test.dtd" encoding="UTF-16" />
 
<xsl:template match="/">
  <content>
    <type1> <xsl:value-of select="data/block"/> </type1>
  </content>
</xsl:template>
</xsl:stylesheet>
 
Now I use following code to do the transformation (partially reproduced)
...
if(tfactory.getFeature(SAXSource.FEATURE)) {
  // Standard way of creating an XMLReader in JAXP 1.1.
  SAXParserFactory pfactory= SAXParserFactory.newInstance();
 
  // Turn on support for XML namespaces.
  pfactory.setNamespaceAware(true);
 
  // Turn on validation.
  pfactory.setValidating(true);
 
  // Get an XMLReader.
  reader = pfactory.newSAXParser().getXMLReader();
 
  // Instantiate an error handler any errors or warnings that occur
  // as the XMLReader is parsing the XML input.
  reader.setErrorHandler(handler);
...
 
Now appareantly the validation is done on the INCOMING xml sheet, not on the TRANSFORMED xml sheet .
 
I need to know if the generated xml code is compliant with the test.dtd mentioned in the xsl sheet.
 
I looked in the API but could not find a solution for this problem.
 
How can I achieve this ?
 
Regards,
 
Stefan

Reply via email to