Martin --

The DOM code looks fine.  I read it just the opposite of how you created
it:

  FileInputStream istream = new
FileInputStream("c:\\temp\\domMartin.ser");
  ObjectInputStream p = new ObjectInputStream(istream);
  Document doc = (Document) p.readObject();
  istream.close();

I think you should send the entire java program that you're using.  You
show the call to transform but not how the transformer itself was
created so I think you should send the entire java program.

Also, please send the -complete- stack trace that you receive.  You may
need to insert a printStackTrace() call in your program to get this.

Gary


Martin Sparenberg wrote:
> 
> Gary L Peskin wrote:
> 
> > It's hard for me to tell from the code you've shown what went wrong.  If
> > you can, serialize the DOM and attach it to the list and I'll have a
> > look.  You can serialize this by adding this to your code:
> 
> The code of the serialized DOM is attached to this posting. It's binary,
> I would like to know how you take a look at it.
> 
> > Also, I'm presuming that you're passing xslDoc to your transformation
> > and not some other Node.
> 
> I'm passing xslDoc to the transformation with:
> 
> DOMSource xslDomSource = new DOMSource();
> xslDomSource.setNode( xslDoc );
> //Use the DocumentBuilder to parse the XML input.
> Document xmlDoc = null;
> try {
>    DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
>    dFactory.setNamespaceAware(true);
>    DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
>    xmlDoc = dBuilder.parse("birds.xml");
> } catch (ParserConfigurationException pce) { [...] }
> DOMSource xmlDomSource = new DOMSource(xmlDoc);
> DOMResult domResult = new DOMResult();
> // and now the interesting part:
> transformer.transform(xmlDomSource, domResult);
> 
> Before that I print out my data for debugging with:
> 
> Serializer serializer = SerializerFactory.getSerializer
>                     (OutputProperties.getDefaultMethodProperties("xml"));
> serializer.setOutputStream(System.out);
> serializer.asDOMSerializer().serialize( xslDoc);
> 
> that works well. So I get e.g.:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output indent="yes" method="xml"/>
> <xsl:template match="Order"><hr/></xsl:template>
> </xsl:stylesheet>
> 
> Martin
> 
>   ------------------------------------------------------------------------
>               Name: dom.ser
>    dom.ser    Type: unspecified type (application/octet-stream)
>           Encoding: base64

Reply via email to