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 "Leitner, Sarah M. [Contractor]" <le...@spawar.navy.mil> on 2002/12/13 20:27:07 UTC

sample code?

To all,

I am still kind of lost on using Xerces for parsing. Does anyone have any
extra documentation or sample kind they can send my way? I've ordered the
book that was recommended to me by someone (Erick?) but it hasn't arrived
yet. I really think that the documentation and sample code needs to be
improved. Although I hate to say that, because I have a two year old so I
know I won't have time to help! Thanks in advance.

Sarah

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


RE: sample code?

Posted by Erik Rydgren <er...@mandarinen.se>.
The difference is that the XercesDOMParser is a little bit more low level.
But if you want to be more W3C DOM level 3 compliant then use the
DOMBuilder.
The only added functionality for you in the XercesDOMParser as I suggested
was the adoptDocument which removes your need for a document clone.
The clone isn't that hard. Just do a cloneNode(true) on the parsed document.

  DOMDocument* poDoc = oParser.Parse(something);
  // Here poDoc is owned by the parser

  [error checking code completly ignored]

  poDoc = poDoc->cloneNode(true);
  // Here poDoc is a NEW document and it must be deleted by you.

To make a long story short: Use the DOMBuilder.

The solution I proposed was based on an assumption that you would design the
XML layout yourself and would get errors often and thereby would like to
have the descriptions for them in memory at all times.
But if you only get errors very seldom then just parse the file whenever an
error has occurred and retreive the data before you destroy the parser.
I can not help you with how you retreive the data, as I do not know the
layout of your XML file.
But I beleive that a standard book about DOM programming explains it enough.
Easiest way is to use a DOMTreeWalker (for deep DOM trees) or a
DOMNodeIterator (for flat DOM trees).

/ Erik

-----Original Message-----
From: Sarah Leitner [mailto:leitners@spawar.navy.mil]
Sent: den 16 december 2002 15:49
To: xerces-c-dev@xml.apache.org
Subject: RE: sample code?


OK, I will tell you what I am doing. I've already had some instructions from
people in the group, but I don't understand Xerces well enough to really
implement them.  And the project seems to have grown more complex since
then.

What it is is the following: we have a huge DTD for our project that is
given to us by an outside group. In this DTD is all the help for the project
as well as all of the error messages that the program will use. Help will be
displayed in a browser, but error messages will need to be parsed to be
displayed when an error occurs. Each will have an error message code and a
message and an action to go with it. So how do I get the code?

I would also like to know precisely what is the difference between a
XercesDOMParser and a DOMBuilder. Is the difference simply that the parser
parses the XML document while the DOMBuilder can take input from several
sources and make it into one document?

Thanks much.

Sarah Leitner

-----Original Message-----
From: Scot Nielsen [mailto:scotnielsen@yahoo.co.uk]
Sent: Friday, December 13, 2002 5:44 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: sample code?


Hello Sarah, can you tell us exactly what you're
trying to do, what you need Xerces to do for you?

Xerces is quite a beast [I hope the contributors don't
mind me saying that] and coming to it fresh I can
certainly see how you might find it a daunting
prospect – I did. But nevertheless, regardless of its
status as an open source development, its level of
software quality is extremely high – its in its nature
to be so if _it_ wishes to succeed.

>>From personal experience, I was quite surprised at how
low-level the applications’ programmer finds themself
to the xml. However, when you consider the effort that
goes into parsing an xml document the learning curve
seems to dwindle in the light of the XML standard
implemented in Xerces.

Regards, Scot.


 --- "Leitner, Sarah M. [Contractor]"
<le...@spawar.navy.mil> wrote: > To all,
>
> I am still kind of lost on using Xerces for parsing.
> Does anyone have any
> extra documentation or sample kind they can send my
> way? I've ordered the
> book that was recommended to me by someone (Erick?)
> but it hasn't arrived
> yet. I really think that the documentation and
> sample code needs to be
> improved. Although I hate to say that, because I
> have a two year old so I
> know I won't have time to help! Thanks in advance.
>
> Sarah
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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


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


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


RE: sample code?

Posted by Sarah Leitner <le...@spawar.navy.mil>.
OK, I will tell you what I am doing. I've already had some instructions from
people in the group, but I don't understand Xerces well enough to really
implement them.  And the project seems to have grown more complex since
then.

What it is is the following: we have a huge DTD for our project that is
given to us by an outside group. In this DTD is all the help for the project
as well as all of the error messages that the program will use. Help will be
displayed in a browser, but error messages will need to be parsed to be
displayed when an error occurs. Each will have an error message code and a
message and an action to go with it. So how do I get the code?

I would also like to know precisely what is the difference between a
XercesDOMParser and a DOMBuilder. Is the difference simply that the parser
parses the XML document while the DOMBuilder can take input from several
sources and make it into one document?

Thanks much.

Sarah Leitner

-----Original Message-----
From: Scot Nielsen [mailto:scotnielsen@yahoo.co.uk]
Sent: Friday, December 13, 2002 5:44 PM
To: xerces-c-dev@xml.apache.org
Subject: Re: sample code?


Hello Sarah, can you tell us exactly what you're
trying to do, what you need Xerces to do for you?

Xerces is quite a beast [I hope the contributors don't
mind me saying that] and coming to it fresh I can
certainly see how you might find it a daunting
prospect – I did. But nevertheless, regardless of its
status as an open source development, its level of
software quality is extremely high – its in its nature
to be so if _it_ wishes to succeed.

>From personal experience, I was quite surprised at how
low-level the applications’ programmer finds themself
to the xml. However, when you consider the effort that
goes into parsing an xml document the learning curve
seems to dwindle in the light of the XML standard
implemented in Xerces.

Regards, Scot.


 --- "Leitner, Sarah M. [Contractor]"
<le...@spawar.navy.mil> wrote: > To all,
>
> I am still kind of lost on using Xerces for parsing.
> Does anyone have any
> extra documentation or sample kind they can send my
> way? I've ordered the
> book that was recommended to me by someone (Erick?)
> but it hasn't arrived
> yet. I really think that the documentation and
> sample code needs to be
> improved. Although I hate to say that, because I
> have a two year old so I
> know I won't have time to help! Thanks in advance.
>
> Sarah
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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


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


Re: sample code?

Posted by Scot Nielsen <sc...@yahoo.co.uk>.
Hello Sarah, can you tell us exactly what you're
trying to do, what you need Xerces to do for you? 

Xerces is quite a beast [I hope the contributors don't
mind me saying that] and coming to it fresh I can
certainly see how you might find it a daunting
prospect – I did. But nevertheless, regardless of its
status as an open source development, its level of
software quality is extremely high – its in its nature
to be so if _it_ wishes to succeed.

>From personal experience, I was quite surprised at how
low-level the applications’ programmer finds themself
to the xml. However, when you consider the effort that
goes into parsing an xml document the learning curve
seems to dwindle in the light of the XML standard
implemented in Xerces. 

Regards, Scot.


 --- "Leitner, Sarah M. [Contractor]"
<le...@spawar.navy.mil> wrote: > To all,
> 
> I am still kind of lost on using Xerces for parsing.
> Does anyone have any
> extra documentation or sample kind they can send my
> way? I've ordered the
> book that was recommended to me by someone (Erick?)
> but it hasn't arrived
> yet. I really think that the documentation and
> sample code needs to be
> improved. Although I hate to say that, because I
> have a two year old so I
> know I won't have time to help! Thanks in advance.
> 
> Sarah
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>  

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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