You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Dave Flanagan <da...@trainingetc.com> on 2002/08/24 04:49:54 UTC

RE: Problem: White space is required between the version and the encoding declaration

Keep in mind that a DTD comes from EBNF - not XML
When the DTD is defined in the external subset - the
only things that should be in your "basic.dtd" file are
<!ELEMENT> declarations and/or <!ATTRIBUTE> declarations
for the most part - the <?xml version="1.0?> should not
be within the external subset of the DTD at all.
Remember that a DTD does not follow the same rules of XML.

One way the problem may appear to you a bit clearer is to consider
what the document would look like if the DTD were in the internal
subset of the Document Type Declaration:
note: line numbers placed simply to reference easier

1. <?xml version="1.0"?>
2. <!DOCTYPE Basic [
3. <?xml version="1.0"?>
4.      <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
5.      <!ELEMENT anInt (#PCDATA)>
6.      <!ELEMENT aDouble (#PCDATA)>
7.      <!ELEMENT aString (#PCDATA)>
8.      <!ELEMENT anotherString (#PCDATA)>
9. ]>


In this form you can see that you are trying to incorporate (2) xml declarations
on line numbers 1 and 3 - this would not be allowed.

For the same reason - moving the DTD to the external subset as in your
original example - still results in (2) xml declarations.


The only things that should be within the <!DOCTYPE> tag are things that
conform to EBNF - not XML

removing the xml declaration from within the <!DOCTYPE should solve your 
probblem.

Hope this helps

Dave Flanagan

-----Original Message-----
At 02:51 PM 8/23/2002 -0700, you wrote:
Will,

Encoding is optional for xml decl.  I am as confused as you're on this.
Anyone else has input on this?

Tom Wang
Panscopic Corporation
Web Reporting, Just Add Data
http://www.panscopic.com/


> -----Original Message-----
> From: Will Hartung [mailto:willh@msoft.com]
> Sent: Friday, August 23, 2002 2:41 PM
> To: xerces-j-user@xml.apache.org; tomw@panscopic.com
> Subject: Re: Problem: White space is required between the version and
> the encoding declaration.
>
>
> So, is the 'encoding' portion required? I thought it was
> optional. Or is it
> only required for DTDs? If I simply add the 'encoding' clause to the DTD,
> then it works, even though the actual XML file has the same, simple <?xml
> version="1.0"?> header.
>
> Confused and peplexed.
>
> Regards,
>
> Will Hartung
> (willh@msoft.com)
>
> ----- Original Message -----
> From: "Tom Wang" <to...@panscopic.com>
> To: <xe...@xml.apache.org>
> Sent: Friday, August 23, 2002 12:40 PM
> Subject: RE: Problem: White space is required between the version and the
> encoding declaration.
>
>
> > Will,
> >
> > You can remove the xml decl or force adding the encoding info:
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> >
> > Tom Wang
> > Panscopic Corporation
> > Web Reporting, Just Add Data
> > http://www.panscopic.com/
> >
> >
> > > -----Original Message-----
> > > From: Will Hartung [mailto:willh@msoft.com]
> > > Sent: Thursday, August 22, 2002 6:13 PM
> > > To: xerces-j-user@xml.apache.org
> > > Subject: Problem: White space is required between the version and the
> > > encoding declaration.
> > >
> > >
> > >
> > > I'm getting this error while I'm trying to parse a simple XML
> document.
> > >
> > > SAXParseException: White space is required between the version and the
> > > encoding declaration.
> > >
> > > The error appears to be in the DTD that it doesn't like the <?xml
> > > version="1.0"?> line, and I don't understand what the issue is. Can
> anyone
> > > provide any hints? I get this error on both 1.4.3 and 1.4.4.
> > >
> > > XML I'm trying to parse:
> > > <?xml version="1.0"?>
> > >
> > > <!DOCTYPE Basic SYSTEM "file:basic.dtd">
> > >
> > > <Basic>
> > >     <anInt>1</anInt>
> > >     <aDouble>2.4</aDouble>
> > >     <aString>This is a string</aString>
> > >     <anotherString>ANother string</anotherString>
> > > </Basic>
> > >
> > > The DTD (in basic.dtd):
> > > <?xml version="1.0"?>
> > > <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
> > >
> > > <!ELEMENT anInt (#PCDATA)>
> > > <!ELEMENT aDouble (#PCDATA)>
> > > <!ELEMENT aString (#PCDATA)>
> > > <!ELEMENT anotherString (#PCDATA)>
> > >
> > > Thanx!
> > >
> > > Best Regards,
> > >
> > > Will Hartung
> > > (willh@msoft.com)

_________________________________________________________________________
This mail sent via toadmail.com, web e-mail @ ToadNet - want to go fast?
http://www.toadmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Problem: White space is required between the version and the encoding declaration

Posted by Will Hartung <wi...@msoft.com>.
ah HA! Yes, that makes complete sense. Very enlightening.

Thanx!

Regards,

Will Hartung
(willh@msoft.com)

----- Original Message -----
From: "Dave Flanagan" <da...@trainingetc.com>
To: <xe...@xml.apache.org>
Sent: Friday, August 23, 2002 7:49 PM
Subject: RE: Problem: White space is required between the version and the
encoding declaration


>
> Keep in mind that a DTD comes from EBNF - not XML
> When the DTD is defined in the external subset - the
> only things that should be in your "basic.dtd" file are
> <!ELEMENT> declarations and/or <!ATTRIBUTE> declarations
> for the most part - the <?xml version="1.0?> should not
> be within the external subset of the DTD at all.
> Remember that a DTD does not follow the same rules of XML.
>
> One way the problem may appear to you a bit clearer is to consider
> what the document would look like if the DTD were in the internal
> subset of the Document Type Declaration:
> note: line numbers placed simply to reference easier
>
> 1. <?xml version="1.0"?>
> 2. <!DOCTYPE Basic [
> 3. <?xml version="1.0"?>
> 4.      <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
> 5.      <!ELEMENT anInt (#PCDATA)>
> 6.      <!ELEMENT aDouble (#PCDATA)>
> 7.      <!ELEMENT aString (#PCDATA)>
> 8.      <!ELEMENT anotherString (#PCDATA)>
> 9. ]>
>
>
> In this form you can see that you are trying to incorporate (2) xml
declarations
> on line numbers 1 and 3 - this would not be allowed.
>
> For the same reason - moving the DTD to the external subset as in your
> original example - still results in (2) xml declarations.
>
>
> The only things that should be within the <!DOCTYPE> tag are things that
> conform to EBNF - not XML
>
> removing the xml declaration from within the <!DOCTYPE should solve your
> probblem.
>
> Hope this helps
>
> Dave Flanagan
>
> -----Original Message-----
> At 02:51 PM 8/23/2002 -0700, you wrote:
> Will,
>
> Encoding is optional for xml decl.  I am as confused as you're on this.
> Anyone else has input on this?
>
> Tom Wang
> Panscopic Corporation
> Web Reporting, Just Add Data
> http://www.panscopic.com/
>
>
> > -----Original Message-----
> > From: Will Hartung [mailto:willh@msoft.com]
> > Sent: Friday, August 23, 2002 2:41 PM
> > To: xerces-j-user@xml.apache.org; tomw@panscopic.com
> > Subject: Re: Problem: White space is required between the version and
> > the encoding declaration.
> >
> >
> > So, is the 'encoding' portion required? I thought it was
> > optional. Or is it
> > only required for DTDs? If I simply add the 'encoding' clause to the
DTD,
> > then it works, even though the actual XML file has the same, simple
<?xml
> > version="1.0"?> header.
> >
> > Confused and peplexed.
> >
> > Regards,
> >
> > Will Hartung
> > (willh@msoft.com)
> >
> > ----- Original Message -----
> > From: "Tom Wang" <to...@panscopic.com>
> > To: <xe...@xml.apache.org>
> > Sent: Friday, August 23, 2002 12:40 PM
> > Subject: RE: Problem: White space is required between the version and
the
> > encoding declaration.
> >
> >
> > > Will,
> > >
> > > You can remove the xml decl or force adding the encoding info:
> > >
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > >
> > > Tom Wang
> > > Panscopic Corporation
> > > Web Reporting, Just Add Data
> > > http://www.panscopic.com/
> > >
> > >
> > > > -----Original Message-----
> > > > From: Will Hartung [mailto:willh@msoft.com]
> > > > Sent: Thursday, August 22, 2002 6:13 PM
> > > > To: xerces-j-user@xml.apache.org
> > > > Subject: Problem: White space is required between the version and
the
> > > > encoding declaration.
> > > >
> > > >
> > > >
> > > > I'm getting this error while I'm trying to parse a simple XML
> > document.
> > > >
> > > > SAXParseException: White space is required between the version and
the
> > > > encoding declaration.
> > > >
> > > > The error appears to be in the DTD that it doesn't like the <?xml
> > > > version="1.0"?> line, and I don't understand what the issue is. Can
> > anyone
> > > > provide any hints? I get this error on both 1.4.3 and 1.4.4.
> > > >
> > > > XML I'm trying to parse:
> > > > <?xml version="1.0"?>
> > > >
> > > > <!DOCTYPE Basic SYSTEM "file:basic.dtd">
> > > >
> > > > <Basic>
> > > >     <anInt>1</anInt>
> > > >     <aDouble>2.4</aDouble>
> > > >     <aString>This is a string</aString>
> > > >     <anotherString>ANother string</anotherString>
> > > > </Basic>
> > > >
> > > > The DTD (in basic.dtd):
> > > > <?xml version="1.0"?>
> > > > <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
> > > >
> > > > <!ELEMENT anInt (#PCDATA)>
> > > > <!ELEMENT aDouble (#PCDATA)>
> > > > <!ELEMENT aString (#PCDATA)>
> > > > <!ELEMENT anotherString (#PCDATA)>
> > > >
> > > > Thanx!
> > > >
> > > > Best Regards,
> > > >
> > > > Will Hartung
> > > > (willh@msoft.com)
>
> _________________________________________________________________________
> This mail sent via toadmail.com, web e-mail @ ToadNet - want to go fast?
> http://www.toadmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: Problem: White space is required between the version and the encoding declaration

Posted by Tom Wang <to...@panscopic.com>.
Dave,

Great points!  thanx!

Tom Wang
Panscopic Corporation
Web Reporting, Just Add Data
http://www.panscopic.com/


> -----Original Message-----
> From: Dave Flanagan [mailto:dave@trainingetc.com]
> Sent: Friday, August 23, 2002 7:50 PM
> To: xerces-j-user@xml.apache.org
> Subject: RE: Problem: White space is required between the version and
> the encoding declaration
> 
> 
> 
> Keep in mind that a DTD comes from EBNF - not XML
> When the DTD is defined in the external subset - the
> only things that should be in your "basic.dtd" file are
> <!ELEMENT> declarations and/or <!ATTRIBUTE> declarations
> for the most part - the <?xml version="1.0?> should not
> be within the external subset of the DTD at all.
> Remember that a DTD does not follow the same rules of XML.
> 
> One way the problem may appear to you a bit clearer is to consider
> what the document would look like if the DTD were in the internal
> subset of the Document Type Declaration:
> note: line numbers placed simply to reference easier
> 
> 1. <?xml version="1.0"?>
> 2. <!DOCTYPE Basic [
> 3. <?xml version="1.0"?>
> 4.      <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
> 5.      <!ELEMENT anInt (#PCDATA)>
> 6.      <!ELEMENT aDouble (#PCDATA)>
> 7.      <!ELEMENT aString (#PCDATA)>
> 8.      <!ELEMENT anotherString (#PCDATA)>
> 9. ]>
> 
> 
> In this form you can see that you are trying to incorporate (2) 
> xml declarations
> on line numbers 1 and 3 - this would not be allowed.
> 
> For the same reason - moving the DTD to the external subset as in your
> original example - still results in (2) xml declarations.
> 
> 
> The only things that should be within the <!DOCTYPE> tag are things that
> conform to EBNF - not XML
> 
> removing the xml declaration from within the <!DOCTYPE should solve your 
> probblem.
> 
> Hope this helps
> 
> Dave Flanagan
> 
> -----Original Message-----
> At 02:51 PM 8/23/2002 -0700, you wrote:
> Will,
> 
> Encoding is optional for xml decl.  I am as confused as you're on this.
> Anyone else has input on this?
> 
> Tom Wang
> Panscopic Corporation
> Web Reporting, Just Add Data
> http://www.panscopic.com/
> 
> 
> > -----Original Message-----
> > From: Will Hartung [mailto:willh@msoft.com]
> > Sent: Friday, August 23, 2002 2:41 PM
> > To: xerces-j-user@xml.apache.org; tomw@panscopic.com
> > Subject: Re: Problem: White space is required between the version and
> > the encoding declaration.
> >
> >
> > So, is the 'encoding' portion required? I thought it was
> > optional. Or is it
> > only required for DTDs? If I simply add the 'encoding' clause 
> to the DTD,
> > then it works, even though the actual XML file has the same, 
> simple <?xml
> > version="1.0"?> header.
> >
> > Confused and peplexed.
> >
> > Regards,
> >
> > Will Hartung
> > (willh@msoft.com)
> >
> > ----- Original Message -----
> > From: "Tom Wang" <to...@panscopic.com>
> > To: <xe...@xml.apache.org>
> > Sent: Friday, August 23, 2002 12:40 PM
> > Subject: RE: Problem: White space is required between the 
> version and the
> > encoding declaration.
> >
> >
> > > Will,
> > >
> > > You can remove the xml decl or force adding the encoding info:
> > >
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > >
> > > Tom Wang
> > > Panscopic Corporation
> > > Web Reporting, Just Add Data
> > > http://www.panscopic.com/
> > >
> > >
> > > > -----Original Message-----
> > > > From: Will Hartung [mailto:willh@msoft.com]
> > > > Sent: Thursday, August 22, 2002 6:13 PM
> > > > To: xerces-j-user@xml.apache.org
> > > > Subject: Problem: White space is required between the 
> version and the
> > > > encoding declaration.
> > > >
> > > >
> > > >
> > > > I'm getting this error while I'm trying to parse a simple XML
> > document.
> > > >
> > > > SAXParseException: White space is required between the 
> version and the
> > > > encoding declaration.
> > > >
> > > > The error appears to be in the DTD that it doesn't like the <?xml
> > > > version="1.0"?> line, and I don't understand what the issue is. Can
> > anyone
> > > > provide any hints? I get this error on both 1.4.3 and 1.4.4.
> > > >
> > > > XML I'm trying to parse:
> > > > <?xml version="1.0"?>
> > > >
> > > > <!DOCTYPE Basic SYSTEM "file:basic.dtd">
> > > >
> > > > <Basic>
> > > >     <anInt>1</anInt>
> > > >     <aDouble>2.4</aDouble>
> > > >     <aString>This is a string</aString>
> > > >     <anotherString>ANother string</anotherString>
> > > > </Basic>
> > > >
> > > > The DTD (in basic.dtd):
> > > > <?xml version="1.0"?>
> > > > <!ELEMENT Basic (anInt?, aDouble?, aString?, anotherString?)>
> > > >
> > > > <!ELEMENT anInt (#PCDATA)>
> > > > <!ELEMENT aDouble (#PCDATA)>
> > > > <!ELEMENT aString (#PCDATA)>
> > > > <!ELEMENT anotherString (#PCDATA)>
> > > >
> > > > Thanx!
> > > >
> > > > Best Regards,
> > > >
> > > > Will Hartung
> > > > (willh@msoft.com)
> 
> _________________________________________________________________________
> This mail sent via toadmail.com, web e-mail @ ToadNet - want to go fast?
> http://www.toadmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org