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 Dara Gowan <da...@hotmail.com> on 2000/06/01 10:50:39 UTC

Newbie Style DTD Question

Newbie Style Questions-
Can I use Xerces to perform "write validation" (which is having an 
appropriate DTD and being able to add elements to the DOM whilst validating 
against the DTD)?

Is there a function that I have totally misssed that creates an XML file 
from a DTD, (obviously with the values missing, a skeleton, as it were.)

Hope that these do not betray too much newbie stupidity?
Thanks
DG
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Re: Newbie Style DTD Question

Posted by "Craig W. Noah" <Cr...@sterling.com>.
Dara,

I'm still fairly new to Xerces, so someone more knowledgeable may correct
me.  I have not found such a function within Xerces.  What I have done is
create a function (isValid, validate, whatever you like) that writes the xml
tree (currently in memory) to a file, then activates the parser against the
file (with the DTD in a known location).

This seems to work for me.  If someone knows of a Better Way, I would like
to know about it.

Craig
----- Original Message -----
From: Dara Gowan <da...@hotmail.com>
To: <xe...@xml.apache.org>
Sent: Thursday, June 01, 2000 3:50 AM
Subject: Newbie Style DTD Question


> Newbie Style Questions-
> Can I use Xerces to perform "write validation" (which is having an
> appropriate DTD and being able to add elements to the DOM whilst
validating
> against the DTD)?
>
> Is there a function that I have totally misssed that creates an XML file
> from a DTD, (obviously with the values missing, a skeleton, as it were.)
>
> Hope that these do not betray too much newbie stupidity?
> Thanks
> DG
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


Re: Newbie Style DTD Question

Posted by Dean Roddey <dr...@charmedquark.com>.
No, there are no such built in functions. You can enumerate through all the
elements and their attributes and their content models, and use that
information to provide such functionality yourself. Look at the EnumVal
sample program.

--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Give me immortality, or give me death"

----- Original Message -----
> Newbie Style Questions-
> Can I use Xerces to perform "write validation" (which is having an
> appropriate DTD and being able to add elements to the DOM whilst
validating
> against the DTD)?
>
> Is there a function that I have totally misssed that creates an XML file
> from a DTD, (obviously with the values missing, a skeleton, as it were.)
>



Re: Newbie Style DTD Question

Posted by Dean Roddey <dr...@charmedquark.com>.
Another option, which I was toying with there just before I went to Portal,
is to write an input source and input stream which directly streams a DOM
document back into the parser. It would take a little work, but it would
have much better performance.

Of course, if you are going to do that, then it should really build on the
XMLFormatter stuff, then you have the base mechanism for restreaming a DOM
document without an intervening file format, which will open up a wide set
of options for other functionality.

--------------------------
Dean Roddey
The CIDLib Class Libraries
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"Give me immortality, or give me death"

----- Original Message -----
> The answers are No and No.  Write Validation is a commonly requested
> feature, but xerces doesn't have it yet.
>
> The best you can do for now is to create the DOM document, write it
> back as XML and re-parse it.  Ugly.



Re: Newbie Style DTD Question

Posted by Andy Heninger <an...@jtcsv.com>.
"Dara Gowan" <da...@hotmail.com> asked

> Can I use Xerces to perform "write validation" (which is having an
> appropriate DTD and being able to add elements to the DOM whilst
validating
> against the DTD)?
>
> Is there a function that I have totally misssed that creates an XML file
> from a DTD, (obviously with the values missing, a skeleton, as it were.)
>

The answers are No and No.  Write Validation is a commonly requested
feature, but xerces doesn't have it yet.

The best you can do for now is to create the DOM document, write it
back as XML and re-parse it.  Ugly.

Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com