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 Mark Lassau <ml...@bisinfo.com.au> on 2003/09/05 06:47:54 UTC

doctype question

Is the following valid xml?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<server>
  <classpath codebase="lib" archives="*"/>
</server>

Xerces DOMParser will not read past the <server> tag.
(tried v2.5.0 and v2.3.0)
(Am I missing some setting?)

I'm not sure exactly what that type of doctype declaration means and 
couldn't find an explanation in my search of web resources.
I figure it must mean either:
a) the only tag allowed here is the root element - <server>
    (ie the file is not valid)
b) the only restriction here is the root element must be <server>
    (ie the file is valid)




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


Re: doctype question

Posted by Michael Glavassevich <mr...@apache.org>.
Hi Mark,

If you don't want validity errors to be reported, you should turn
validation off. The parser never ignores the DOCTYPE. Even if you're not
validating, it will still read the DTD and add default attributes, and
perform entity substitution.

Have a look at:
http://xml.apache.org/xerces2-j/faq-write.html#faq-3

On Fri, 5 Sep 2003, Mark Lassau wrote:

> Michael Glavassevich wrote:
>
> Thanks Michael.
> Given that is the case, is there a setting in Xerces to ignore the
> doctype declaration?
>
> I'm trying to parse third-party xml files (JBoss config files - example
> was a stripped-down copy).
> If I remove the <!DOCTYPE server> tag, then DOMParser parses the whole
> file for me.

--------------------
Michael Glavassevich
mrglavas@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: doctype question

Posted by Mark Lassau <ml...@bisinfo.com.au>.
Michael Glavassevich wrote:

 > Hi Mark,
 >
 > Your document is well formed, but isn't valid.
 >
 > <snip>


Thanks Michael.
Given that is the case, is there a setting in Xerces to ignore the 
doctype declaration?

I'm trying to parse third-party xml files (JBoss config files - example 
was a stripped-down copy).
If I remove the <!DOCTYPE server> tag, then DOMParser parses the whole 
file for me.



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


Re: doctype question

Posted by Michael Glavassevich <mr...@apache.org>.
Hi Mark,

Your document is well formed, but isn't valid.

<!DOCTYPE server> just means that a valid root element for the document is
'server', but you still need to declare 'server' in your DTD, as well as
the rest of your elements and attributes (even if you declare 'server' as
<!ELEMENT server ANY>), in order for your document to be valid.

Hope that helps.

On Fri, 5 Sep 2003, Mark Lassau wrote:

> Is the following valid xml?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE server>
> <server>
>   <classpath codebase="lib" archives="*"/>
> </server>
>
> Xerces DOMParser will not read past the <server> tag.
> (tried v2.5.0 and v2.3.0)
> (Am I missing some setting?)
>
> I'm not sure exactly what that type of doctype declaration means and
> couldn't find an explanation in my search of web resources.
> I figure it must mean either:
> a) the only tag allowed here is the root element - <server>
>     (ie the file is not valid)
> b) the only restriction here is the root element must be <server>
>     (ie the file is valid)

--------------------
Michael Glavassevich
mrglavas@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