Xerces supports both DTD's and Schemas.

Take a look at the examples how to use validation. It isn't hard.

/ Erik

> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 7 november 2003 11:49
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
>       Thank you for your help. I finally succeded to make it work.
> 
>       Does Xerces supports XML Schema and/or DTD validation?
> 
> Best regards,
> Milan
> 
> 
> 
> -----Original Message-----
> From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 07, 2003 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
> Are you SURE you are in the right place in the tree? Assuming a tree
> that looks like this
> 
> A
> |- B
> |- C
> |- D
> 
> walker = doc.createTreeWalker(doc.getDocumentElement(),
> DOMNodeFilter::SHOW_ELEMENT, NULL, true);
> // here walker current pos is A
> if (walker->firstChild() != NULL) {
>   // Here walker current pos is B
>   while (walker->nextSibling() != NULL) {
>     // here walker current pos is C and D in order
>   }
>   // here walker STILL has current pos D
> }
> 
> / Erik
> 
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 6 november 2003 17:10
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
>     Thank you for your help. firstChild() works well, but
nextSibling()
> returns NULL, altough there is more then 1 node. :(
> 
> Best regards,
> Milan
> 
> 
> -----Original Message-----
> From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 06, 2003 2:48 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> You should not use the nextNode method. It iterates ALL nodes in the
> tree in order. Use firstChild and nextSibling instead.
> 
> / Erik
> 
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 6 november 2003 14:44
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
>     I have one problem. Both createTreeWalker() and
createNodeIterator()
> goes through ALL nodes in the XML document. It should iterate only
> through child nodes of first given node (root node in this example).
> Here is code sample:
> 
> DOMTreeWalker* walker = theDOM->createTreeWalker(rootElem,
> DOMNodeFilter::SHOW_ELEMENT, NULL, true);
> for ( tmpNode = (DOMElement*)walker->nextNode(); tmpNode != 0; tmpNode
=
> (DOMElement*)walker->nextNode() )
> {
>   char *strValue = XMLString::transcode( tmpNode->getNodeName() );
>   ShowMessage(strValue);
>   XMLString::release(&strValue);
> }
> 
>     It iterates through ALL nodes in the document, but it should show
> only child nodes (elements) of root node.
> 
> Thanks.
> 
> Milan
> 
> 
> -----Original Message-----
> From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 05, 2003 4:30 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> It looks correct to me. Do you really see #text nodes while traversing
> the tree through iterator->nextNode() ? That is weird. Now I’m all out
> of answers. Sorry.
> 
> / Erik
> 
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 5 november 2003 16:13
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
>     I'm using this:
> 
> DOMNodeIterator* iterator = theDOM->createNodeIterator(rootElem,
> DOMNodeFilter::SHOW_ELEMENT, NULL, true);
> 
>     but I still see #text "nodes". Am I missing something? I'd like to
> see only real elements (i.e. <SomeElement/>), nothing else.
> 
> Thank you.
> 
> 
> -----Original Message-----
> From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 05, 2003 2:33 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> Use the createTreeWalker method or createNodeIterator method on the
> DOMDocument.
> 
> / Erik
> 
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 5 november 2003 13:04
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> 
> 
> Thank you.
> 
> > easiest is to create a tree iterator that doesn’t show text nodes
> while traversing the DOM tree.
> 
> How can I do that?
> 
> Milan
> 
> 
> -----Original Message-----
> From: Erik Rydgren [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 05, 2003 12:58 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Parser
> That is standard DOM behavior. The carage-return line-feed characters
> you have mixed into the XML are treated as non ignorable text content.
> Hence text nodes are created. There are several ways to solve your
> problem but the easiest is to create a tree iterator that doesn’t show
> text nodes while traversing the DOM tree.
> 
> Another way is to remove ignorable whitespace during parsing, but that
> requires that validation is on and that you have a schema that tells
the
> parser which white space is ignorable and which is not.
> 
> / Erik
> 
> -----Original Message-----
> From: Milan Tomic [mailto:[EMAIL PROTECTED]
> Sent: den 5 november 2003 12:22
> To: Xerces-C
> Subject: Parser
> 
> 
>     I'm iterating through nodes:
> tmpNode =
> (DOMElement*)tmpNode->getChildNodes()->item(atoi(nodePos.c_str()));
>     but I got some strange "tags" with "#text" name when parser found
> $0D$0A bytes between two tags. How can I disable this? I'd like parser
> to retrive only valid tags and if found $0D$0A between tags to ignore
it
> as a "tag". Thank you.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to