You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ecs-user@jakarta.apache.org by "Rob S." <rs...@home.com> on 2002/01/24 23:12:15 UTC

So close yet so far: DOCTYPE

Hiya everyone,

Upon using the following code:

Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd");

ECS outputs:

<!DOCTYPE horizons PUBLIC SYSTEM etc/horizons.dtd>

If "SYSTEM" is supplied, shouldn't it replace "PUBLIC?"  From the XML spec:

ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S 
SystemLiteral

Seems like the mailing list archives are either down or unsearchable =/

Thanks in advance! =)

- r


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by sn...@sbcglobal.net.
Been awhile since I've looked at it and the box with all my code on it
popped a power supply yesterday, but I think that if you
setPrettyPrint(true) on the parent element before adding any children the
children will inherit the state.  I may have disabled that functionality in
the XmlElement, I don't remember off hand.  This is fixed in the ecs2
codebase that I haven't done any work on in awhile, but is checked into cvs.

-stephan

----- Original Message -----
From: "Chris Reeves" <ch...@mindspring.com>
To: "ECS Users List" <ec...@jakarta.apache.org>
Sent: Saturday, January 26, 2002 1:48 PM
Subject: Re: So close yet so far: DOCTYPE


> > I have to setPrettyPrint() for every element I want pretty printed.  I
> > assumed setting a parent element to pretty print would affect all
children
> > as well, but it doesn't.  I figured I'll just attach the file since it's
> > pretty short.  The part you're interested in is right at the top (re:
> > writeXML()).
>
> I ran up against the setPrettyPrint issue recently. I too discovered that
I
> must setPrettyPrint for every element I generate.
>
> I suspect that I could extend the XML element class and do
> setPrettyPrint(true) as the default; has anyone seen this done?
>
> Thanks,
> Chris
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by Chris Reeves <ch...@mindspring.com>.
> I have to setPrettyPrint() for every element I want pretty printed.  I
> assumed setting a parent element to pretty print would affect all children
> as well, but it doesn't.  I figured I'll just attach the file since it's
> pretty short.  The part you're interested in is right at the top (re:
> writeXML()).

I ran up against the setPrettyPrint issue recently. I too discovered that I
must setPrettyPrint for every element I generate.

I suspect that I could extend the XML element class and do
setPrettyPrint(true) as the default; has anyone seen this done?

Thanks,
Chris


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
>i've taken a quick look but i can't find an obvious easy fix. pretty print 
>formatting is controlled by the parent not the child so it'd be useful if 
>you could tell me what your particular parent element is or even better 
>supply a small snippet of code giving me an example of your use of Doctype.

I have to setPrettyPrint() for every element I want pretty printed.  I 
assumed setting a parent element to pretty print would affect all children 
as well, but it doesn't.  I figured I'll just attach the file since it's 
pretty short.  The part you're interested in is right at the top (re: 
writeXML()).

- r

Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
>i've committed a fix for the doctype pretty print bug into cvs.

Awesome, thanks very much! =)

- r


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
>attribute but at the moment how to do it is a bit obscure (to me). if this 
>is important to you, i'll take a look into it.

Not really, but thanks for the offer ;)

- r


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by robert burrell donkin <ro...@mac.com>.
hi rob

i've committed a fix for the doctype pretty print bug into cvs.

- robert

On Saturday, January 26, 2002, at 07:33 PM, Rob S. wrote:

> Oops, sent the message too quickly =)
>
> Here's the first few lines of the file... note how there's no "encoding" 
> attribute in the processing instruction, even though I've used a 
> constructor specifying it.  As well, there is no line break after the 
> <!DOCTYPE>.
>
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE horizons SYSTEM "etc/horizons.dtd" ><horizons>
>         <legislature country_number="34" year="2002" country_name="United 
> States" seats="100" next_result="17">
>                 <parties>
>
> - r
>
> At 06:29 AM 1/26/2002, you wrote:
>
>> On Thursday, January 24, 2002, at 11:08 PM, Rob S. wrote:
>>
>>> Bingo!  Thanks a lot Robert! =)
>>>
>>> Icing on the cake would be if I could get a carriage return before the 
>>> root element (after the DTD), having already set everything to 
>>> prettyPrint.  I can live with that because it's just an aesthetic issue,
>>>  thankfully ;)
>>
>> i've taken a quick look but i can't find an obvious easy fix. pretty 
>> print formatting is controlled by the parent not the child so it'd be 
>> useful if you could tell me what your particular parent element is or 
>> even better supply a small snippet of code giving me an example of your 
>> use of Doctype.
>>
>> - robert
>>
>>
>> --
>> To unsubscribe, e-mail:   <mailto:ecs-user-
>> unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail: <mailto:ecs-user-
>> help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by robert burrell donkin <ro...@mac.com>.
On Saturday, January 26, 2002, at 07:33 PM, Rob S. wrote:

> Here's the first few lines of the file... note how there's no "encoding" 
> attribute in the processing instruction, even though I've used a 
> constructor specifying it.

hi rob

this explanation is going to sound a little obscure...

the codeset specified in the constructor is not equivalent in meaning to 
the (xml) encoding of the document. the codeset is used to determine the 
default encoding that's used to output the document. (this is not 
sufficient to ensure that this encoding will actually be used.) you should 
really be able to set the encoding attribute but at the moment how to do 
it is a bit obscure (to me). if this is important to you, i'll take a look 
into it.

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
Oops, sent the message too quickly =)

Here's the first few lines of the file... note how there's no "encoding" 
attribute in the processing instruction, even though I've used a 
constructor specifying it.  As well, there is no line break after the 
<!DOCTYPE>.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE horizons SYSTEM "etc/horizons.dtd" ><horizons>
         <legislature country_number="34" year="2002" country_name="United 
States" seats="100" next_result="17">
                 <parties>

- r

At 06:29 AM 1/26/2002, you wrote:

>On Thursday, January 24, 2002, at 11:08 PM, Rob S. wrote:
>
>>Bingo!  Thanks a lot Robert! =)
>>
>>Icing on the cake would be if I could get a carriage return before the 
>>root element (after the DTD), having already set everything to 
>>prettyPrint.  I can live with that because it's just an aesthetic issue, 
>>thankfully ;)
>
>i've taken a quick look but i can't find an obvious easy fix. pretty print 
>formatting is controlled by the parent not the child so it'd be useful if 
>you could tell me what your particular parent element is or even better 
>supply a small snippet of code giving me an example of your use of Doctype.
>
>- robert
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by robert burrell donkin <ro...@mac.com>.
On Thursday, January 24, 2002, at 11:08 PM, Rob S. wrote:

> Bingo!  Thanks a lot Robert! =)
>
> Icing on the cake would be if I could get a carriage return before the 
> root element (after the DTD), having already set everything to 
> prettyPrint.  I can live with that because it's just an aesthetic issue, 
> thankfully ;)

i've taken a quick look but i can't find an obvious easy fix. pretty print 
formatting is controlled by the parent not the child so it'd be useful if 
you could tell me what your particular parent element is or even better 
supply a small snippet of code giving me an example of your use of Doctype.

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
Bingo!  Thanks a lot Robert! =)

Icing on the cake would be if I could get a carriage return before the root 
element (after the DTD), having already set everything to prettyPrint.  I 
can live with that because it's just an aesthetic issue, thankfully ;)

- r

At 02:50 PM 1/24/2002, robert burrell donkin wrote:
>hi rob
>
>i think that you can do what you need by using the other constructor eg.
>
>Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd", "")
>;
>
>i do agree that this is a bit confusing and pretty badly documented. it 
>might be a good idea to add a factory method.
>
>BTW this is from the latest version in cvs so if it so happens that that 
>constructor is missing in the version that you're using, check out and 
>build the latest source from cvs.
>
>- robert
>
>On Thursday, January 24, 2002, at 10:20 PM, Rob S. wrote:
>
>>Err, I should have explained the subject.  I wrote a pretty big SAX2 
>>parser a few days ago, and this is the only thing left before the writer 
>>will be finished =)
>>
>>- r
>>
>>At 02:12 PM 1/24/2002, Rob S. wrote:
>>>Hiya everyone,
>>>
>>>Upon using the following code:
>>>
>>>Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd");
>>>
>>>ECS outputs:
>>>
>>><!DOCTYPE horizons PUBLIC SYSTEM etc/horizons.dtd>
>>>
>>>If "SYSTEM" is supplied, shouldn't it replace "PUBLIC?"  From the XML spec:
>>>
>>>ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S 
>>>SystemLiteral
>>>
>>>Seems like the mailing list archives are either down or unsearchable =/
>>>
>>>Thanks in advance! =)
>>>
>>>- r
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:   <mailto:ecs-user->> 
>>>unsubscribe@jakarta.apache.org>
>>>For additional commands, e-mail: <mailto:ecs-user->> 
>>>help@jakarta.apache.org>
>>
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by robert burrell donkin <ro...@mac.com>.
hi rob

i think that you can do what you need by using the other constructor eg.

Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd", "")
;

i do agree that this is a bit confusing and pretty badly documented. it 
might be a good idea to add a factory method.

BTW this is from the latest version in cvs so if it so happens that that 
constructor is missing in the version that you're using, check out and 
build the latest source from cvs.

- robert

On Thursday, January 24, 2002, at 10:20 PM, Rob S. wrote:

> Err, I should have explained the subject.  I wrote a pretty big SAX2 
> parser a few days ago, and this is the only thing left before the writer 
> will be finished =)
>
> - r
>
> At 02:12 PM 1/24/2002, Rob S. wrote:
>> Hiya everyone,
>>
>> Upon using the following code:
>>
>> Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd");
>>
>> ECS outputs:
>>
>> <!DOCTYPE horizons PUBLIC SYSTEM etc/horizons.dtd>
>>
>> If "SYSTEM" is supplied, shouldn't it replace "PUBLIC?"  From the XML 
>> spec:
>>
>> ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S 
>> SystemLiteral
>>
>> Seems like the mailing list archives are either down or unsearchable =/
>>
>> Thanks in advance! =)
>>
>> - r
>>
>>
>> --
>> To unsubscribe, e-mail:   <mailto:ecs-user-
>> unsubscribe@jakarta.apache.org>
>> For additional commands, e-mail: <mailto:ecs-user-
>> help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: So close yet so far: DOCTYPE

Posted by "Rob S." <rs...@home.com>.
Err, I should have explained the subject.  I wrote a pretty big SAX2 parser 
a few days ago, and this is the only thing left before the writer will be 
finished =)

- r

At 02:12 PM 1/24/2002, Rob S. wrote:
>Hiya everyone,
>
>Upon using the following code:
>
>Doctype dtdRef = new Doctype("horizons", "SYSTEM", "etc/horizons.dtd");
>
>ECS outputs:
>
><!DOCTYPE horizons PUBLIC SYSTEM etc/horizons.dtd>
>
>If "SYSTEM" is supplied, shouldn't it replace "PUBLIC?"  From the XML spec:
>
>ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S 
>SystemLiteral
>
>Seems like the mailing list archives are either down or unsearchable =/
>
>Thanks in advance! =)
>
>- r
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>