You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "LiChao (李超)" <li...@founder.com.cn> on 2001/07/06 07:52:39 UTC
Re: Check error in scan DTD--Description my question in detail--S
orry
I feel so sorry...
If I don't know the root of the DTD,I couldn't have built the temporary XML
file at all.
As I had wrote
<!DOCTYPE DOC SYSTEM "theMysteryDTDFile.dtd" >
then *DOC* must be the root element!
But how could I finish my aim if I even don't know the root? How to parse a
DTD when I know nothing about it?
-----原始邮件-----
发件人: LiChao(李超) [mailto:lichao@founder.com.cn]
发送时间: 2001年7月6日 13:31
收件人: 'xerces-c-dev@xml.apache.org'
主题: Re: Check error in scan DTD--Description my question in detail
Hi,jas
Maybe I hadn't descripted my question clearly.
I have a DTD file. I don't know the content of the file. I don't know which
is the root of the DTD. Now I want to use xerces to check the syntax of the
file.In order to use the SAXParser as Jas suggested,I built a temporary XML
file as the following:
<?xml version="1.0" ?>
<!DOCTYPE DOC SYSTEM "theMysteryDTDFile.dtd" >
Because I know nothing about the DTD except its file name, I can't build a
complete XML file.
Everything works well and I have parsed the DTD as I hoped.But new question
arises...
Is there any trick to filtrate the err message of "The main XML document
cannot be empty"?
Thanks a lot.
Super
> 2) Jas' answer has solved my question perfectly, but it brings another
> question: How to filte the err message of "The main XML document cannot be
> empty"? The XML file is a temp file used to parse DTD, and I don't know
> anything of the DTD(even the root!!), so I can't build a complete XML file
> except an file only contains the prolog.
>
> My temp XML file is like this:
> <?xml version="1.0" encoding="gb2312"?>
> <!DOCTYPE DOC SYSTEM "f:\xml_file\doc.dtd" >
simply add the tag <DOC/> after that.
The error message told you that you have a blank document (you just
had the XML Declaration and the Doctype, but no xml tags. That's an
error.
<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE DOC SYSTEM "f:\xml_file\doc.dtd" >
<DOC/>
The FAQ isn't really going to help with these kinds of questions. I
would get a basic book on XML to start.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Check error in scan DTD--Description my question in detail--S orry
Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"LiChao(À)" <li...@founder.com.cn> writes:
> I feel so sorry...
> If I don't know the root of the DTD,I couldn't have built the temporary XML
> file at all.
> As I had wrote
> <!DOCTYPE DOC SYSTEM "theMysteryDTDFile.dtd" >
> then *DOC* must be the root element!
>
> But how could I finish my aim if I even don't know the root? How to parse a
> DTD when I know nothing about it?
Write your own error handler and when you get an error with message:
Message: Element 'DOC' was used in the DOCTYPE but never declared
keep going and don't exit.
jas.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org