Given:
> <XmlConfiguration>
>   <Url>url configuration</Url>
> </XmlConfiguration>

I tried the following:
I got DOMNodeList of the XMLConfiguration element. It contained one
element node of name 'Url' as expected.

When I got a list of children for the 'Url' node and got an empty list
as one would expect. I don't understand what you mean by getting
children of that element and filtering out for a TEXT_NODE.

My expectation is that because I am not validating, xerces takes the
'Url' element to be of type ELEMENT_NODE even when it's contents are
just text. Then the only solution would be that I need to set some flag
somewhere to make this possible or that I need to use XML schema. Or, my
understanding of xerces API has many flaws and I just don't know what I
am doing. I have reviewed the documentation but failed to figure this
out. If you could point me to specific part of documentation I should be
looking at I would appreciated that. I have so far read the DOXYGEN
generated files for DOMNode, DOMText, DOMElement, DOMNodeList and
XercesDOMParser (being most relevant).

Martin Bosticky
Software Engineer
Action Information Management Ltd.
Tel: (01225) 711200
Fax: (01225) 711222
Email: [EMAIL PROTECTED]


-----Original Message-----
From: Gareth Reakes [mailto:gareth@;decisionsoft.com] 
Sent: 24 October 2002 11:09
To: [EMAIL PROTECTED]
Subject: RE: getNodeValue() doesn't work?

Hi,
        you are getting nodes of type element_node because you requested
that. You cannot force an element node to be a text node. If you want
the
text content of an element node you could get the children of the
element
node and filter out elements or you could use something like
getTextContent (the docs are in DOMNode) if you did not mind it being
recursive.

Gareth 



On Thu, 24 Oct 2002, Martin Bosticky wrote:

> I am assuming you mean that I am getting node of type ELEMENT_NODE
when
> really I want type TEXT_NODE. Ok, well, I am parsing an xml like:
> <XmlConfiguration>
>   <Url>url configuration</Url>
> </XmlConfiguration>
> and trying to get the "url configuration" string.
> 
> But I am not using any schema hence no validation since I just wanted
to
> have a simple XML configuration file with minimum overheads.
> 
> Was this a bad idea?
> How can I force the node to be a TEXT_NODE?
> 
> Martin.
> 
> Martin Bosticky
> Software Engineer
> Action Information Management Ltd.
> Tel: (01225) 711200
> Fax: (01225) 711222
> Email: [EMAIL PROTECTED]
> 
> 
> -----Original Message-----
> From: Gareth Reakes [mailto:gareth@;decisionsoft.com] 
> Sent: 24 October 2002 10:11
> To: [EMAIL PROTECTED]
> Subject: Re: getNodeValue() doesn't work?
> 
> Hi,
>       the behaviour you are seeing is correct. Look at the docs for 
> DOMNode where the return value for each of the node types is shown.
> 
> Gareth
> 
> 
> On Thu, 24 Oct 2002, Martin Bosticky wrote:
> 
> > Hello. The way I apply my code means that getNodeValue() on
DOMElement
> > does not work correctly!
> >  
> > I have just joined the mailing group and done some search in
bugzilla
> to
> > see if this is a known bug or what is going on?
> >  
> > I am using xercesc 2.1.0 in C++ and the code and my XML are very
> > trivial:
> >  
> > Alfter parsing the document I get the top element and from that an
> > element that I am interested in:
> >  
> > DOMNodeList* node 
> > docElement->getElementsByTagName(XMLString::transcode("Url"));
> >                                     DOMNode* el = (node->item(0));
> >                                     std::string vl_Child1_str 
> > CreateString(el->getNodeName());
> >                                     std::string vl_Url_str 
> > CreateString(el->getNodeValue());
> >  
> > The node 'el' that I obtain has the correct node name and so I try
to
> > get the node value which should be text. But getNodeValue() returns
a
> > null pointer.
> >  
> > **********************************************************
> > I checked the source code and discovered that it seems like the
> > DOMNodeImpl class has the function as a virtual function but the
> derived
> > object DOMElementImpl never overrides this so you will always get a
> null
> > pointer no matter what.
> > **********************************************************
> >  
> > I have tested my XML by putting the desired url string into an
> attribute
> > and then I can easily retrieve it using getAttributes() etc.
> >  
> > Bugzilla didn't turn up anything that was up to date. Is this
problem
> > known?
> > Should I do parsing another way that would work?
> > Is version 2.1.0 full of bugs and I should not be using it?
> > What to do?
> >  
> > Any comments would be appreciated, Martin.
> >  
> > Martin Bosticky
> > Software Engineer
> > Action Information Management Ltd.
> > Tel: (01225) 711200
> > Fax: (01225) 711222
> > Email: [EMAIL PROTECTED]
> >  
> > 
> > 
> > 
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 

-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
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