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 Yuan Yuan <yu...@gmail.com> on 2008/05/06 05:29:01 UTC

Help! Why I got an extra contr="false" for element person?

I used dom.Writer and personal.xml from the Xerces sample.

but I got an extra contr="false" for element "person" from the output.

The original xml file is:

<person id="four.worker">
    <name><family>Worker</family> <given>Four</given></name>
    <email>four@foo.com</email>
    <link manager="Big.Boss"/>
  </person>


but I got:

<person contr="false" id="four.worker">
  <name><family>Worker</family> <given>Four</given></name>
  <email>four@foo.com</email>
  <link manager="Big.Boss"></link>
</person>

Could please somebody tell me where is this contr="false" attribute come
from?

Thanks a lot!

Yuan Yuan

Re: Help! Why I got an extra contr="false" for element person?

Posted by Yuan Yuan <yu...@gmail.com>.
HI Michael,

Thanks a lot!

I never thought it could be the default value defined in DTD...

It is my fault.

Yuan Yuan


2008/5/6, Yuan Yuan <yu...@gmail.com>:
>
> I used dom.Writer and personal.xml from the Xerces sample.
>
> but I got an extra contr="false" for element "person" from the output.
>
> The original xml file is:
>
> <person id="four.worker">
>     <name><family>Worker</family> <given>Four</given></name>
>     <email>four@foo.com</email>
>     <link manager="Big.Boss"/>
>   </person>
>
>
> but I got:
>
> <person contr="false" id="four.worker">
>   <name><family>Worker</family> <given>Four</given></name>
>   <email>four@foo.com</email>
>   <link manager="Big.Boss"></link>
> </person>
>
> Could please somebody tell me where is this contr="false" attribute come
> from?
>
> Thanks a lot!
>
> Yuan Yuan
>

Re: Help! Why I got an extra contr="false" for element person?

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Yuan,

"contr" is an attribute which is defaulted [1] from the DTD associated with
personal.xml. The attribute declaration which declares the default value is
in personal.dtd: <!ATTLIST person contr (true|false) 'false'>.

Thanks.

[1] http://www.w3.org/TR/2006/REC-xml-20060816/#sec-attr-defaults

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Yuan Yuan" <yu...@gmail.com> wrote on 05/05/2008 11:29:01 PM:

> I used dom.Writer and personal.xml from the Xerces sample.
>
> but I got an extra contr="false" for element "person" from the output.
>
> The original xml file is:
>
> <person id="four.worker">
>     <name><family>Worker</family> <given>Four</given></name>
>     <email>four@foo.com</email>
>     <link manager="Big.Boss"/>
>   </person>
>
>
> but I got:
>
> <person contr="false" id="four.worker">
>   <name><family>Worker</family> <given>Four</given></name>
>   <email>four@foo.com</email>
>   <link manager="Big.Boss"></link>
> </person>
>
> Could please somebody tell me where is this contr="false" attribute come
from?
>
> Thanks a lot!
>
> Yuan Yuan