You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by dara <da...@risaris.com> on 2005/08/23 01:32:18 UTC

Creating a DOM and validating

Hi All,

I am just wondering if any of you have any neat ideas about validating a 
newly constructed DOM before writing it to a file.

Basically I wish to :

    -create the DOM tree complete with data in the elements
    -validate this using an XSD specific to the document
    -write the XML to a file/buffer

The first and last items I have working fine, but the validation of the 
document before writing is proving sligthly elusive for the moment.

There is validation of the data before it is entered into the DOM, but I 
would like to validate it against the XSD as an added measure, and 
without having the expense of re-parsing the serialised DOM if possible.

I don't see anything obvious, in the DOMDocument class at least.

Many thanks in advance for any pointers etc,

Kind Regards

Dara



Re: Creating a DOM and validating

Posted by dara <da...@risaris.com>.
>Hi Dara,
>
>the only way to validate a constructed DOM tree is to serialize and 
>re-parse it. Xerces has no support for 'smart editor' capabilities, but 
>is a standard-conform validating xml parser.
>
>Cheers,
>			Axel
>
>  
>

I was hoping that would not be the answer :)

Thanks Axel

Regards

Dara

Re: Creating a DOM and validating

Posted by Axel Weiß <aw...@informatik.hu-berlin.de>.
dara wrote:
> Hi All,
>
> I am just wondering if any of you have any neat ideas about validating
> a newly constructed DOM before writing it to a file.
>
> Basically I wish to :
>
>     -create the DOM tree complete with data in the elements
>     -validate this using an XSD specific to the document
>     -write the XML to a file/buffer
>
> The first and last items I have working fine, but the validation of
> the document before writing is proving sligthly elusive for the
> moment.
>
> There is validation of the data before it is entered into the DOM, but
> I would like to validate it against the XSD as an added measure, and
> without having the expense of re-parsing the serialised DOM if
> possible.
>
> I don't see anything obvious, in the DOMDocument class at least.

Hi Dara,

the only way to validate a constructed DOM tree is to serialize and 
re-parse it. Xerces has no support for 'smart editor' capabilities, but 
is a standard-conform validating xml parser.

Cheers,
			Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **