David,

sorry if I was not clear reagarding the href attribute.

I just meant that the xml file contains a reference to the xsl file, as in:
<?xml version="1.0" encoding="UTF-16" standalone="no" ?>

<?xml-stylesheet href="invoice.xsl" type="text/xsl"?>

I still have to test but maybe need to mark(int) and reset() the xmlstream
before I can start the transformation ?

If not, the stream is already read and Xerces will see an empty stream so
giving  the Re: The root element is required in a well-formed document
error.

Stefan



----- Original Message -----
From: "David Nelson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 29, 2002 11:42 PM
Subject: RE: The root element is required in a well-formed document.


> Well maybe I can take a shot at this.  I'm not familiar with the
technique:
> "href= attribute" but if whatever this is has to read part of the incoming
> stream, then the xml header would no longer be available to the xerces
> parser in the resulting stream, which would then throw an error.
>
> I'm really just taking a stab since no one else seems to be responding so
I
> suspect that this message will be royally fileted for naive assumptions.
>
> Good Luck.
>
>
> -->  -----Original Message-----
> -->  From: Stefan Geelen [mailto:[EMAIL PROTECTED]]
> -->  Sent: Monday, April 29, 2002 3:41 PM
> -->  To: [EMAIL PROTECTED]
> -->  Cc: [EMAIL PROTECTED]
> -->  Subject: Re: The root element is required in a well-formed
> -->  document.
> -->
> -->
> -->  Joseph,
> -->
> -->  I finally found out that appareantly the 'The root element
> -->  is required in a
> -->  well-formed document.' is caused when I try to detect if a
> -->  xmlstream has a
> -->  xslfile defined via the href= attribute:
> -->
> -->        try { // Check if xml has link to stylesheet
> -->           System.err.println("Looking for XSL file...");
> -->
> -->           // Look for stylesheet in xmlfile/stream/reader
> -->           if (xmlfile != null) {
> -->             System.err.println("Looking in xmlfile");
> -->             xslsource = tfactory.getAssociatedStylesheet(new
> -->  StreamSource(xmlfile),media, title, charset);
> -->             if (xslsystemid == (null))
> -->               xslsystemid = xmlfile.toString();
> -->           } else {
> -->              if (xmlstream != null) {  // IT GOES WRONg HERE !
> -->                xslsource = tfactory.getAssociatedStylesheet(new
> -->  StreamSource(xmlstream),media, title, charset);
> -->                System.err.println("Looking in xmlstream");
> -->              } else {
> -->                if (xmlreader != null) {
> -->                  xslsource = tfactory.getAssociatedStylesheet(new
> -->  StreamSource(xmlreader),media, title, charset);
> -->                  System.err.println("Looking in xmlreader");
> -->                }
> -->              }
> -->            }
> -->
> -->  As long as it is a xmlFILE then there is no problem, but
> -->  when it is a
> -->  xmlstream the problem arises (didn't check with a xmlreader).
> -->
> -->  I use XalanD22R14.
> -->
> -->  Is this a bug, do I something wrong or is this maybe
> -->  solved in 2.3.1 ?
> -->
> -->  Regards,
> -->
> -->  Stefan
> -->
> -->  ----- Original Message -----
> -->  From: "Joseph Kesselman/CAM/Lotus" <[EMAIL PROTECTED]>
> -->  To: <[EMAIL PROTECTED]>
> -->  Sent: Monday, April 29, 2002 3:59 PM
> -->  Subject: Re: The root element is required in a well-formed
> -->  document.
> -->
> -->
> -->  >
> -->  > Have you tried printing the content of the stream to
> -->  make sure that what's
> -->  > being retrieved is, in fact, a well-formed XML document?
> -->  >
> -->  > (For what it's worth, that error message is actually
> -->  coming from Xerces,
> -->  > before Xalan per se sees the document's content.)
> -->  >
> -->  >
> -->  >
> -->
>

Reply via email to