Hi Vu,

At 18.46 24/02/2005 -0500, Vu Nguyen wrote:

Just in case you did not get this one. Here all the necessary attachments.

It looks like I finally got your attachments ;-)

There is a bug in your code, that will cause to expand just the first element.
Inside buildCLISubTree(DOMNode *n, int depth) you first display the attributes, then you do this:


  if (n->getNodeType() == DOMNode::ELEMENT_NODE )
  {
    for(child= n->getFirstChild(); child!=0; child=child->getNextSibling())
    {
      buildCLISubTree(child, depth++);
    }
  } else {
    buildCLISubTree(n->getNextSibling(), depth++);
  }

This means that when you invoke buildCLISubTree on an element, you will drill down to its children, but you will never explore its siblings.
The correct code is:


  if (n->getNodeType() == DOMNode::ELEMENT_NODE )
  {
    for(child= n->getFirstChild(); child!=0; child=child->getNextSibling())
    {
      buildCLISubTree(child, depth++);
    }
  }
  buildCLISubTree(n->getNextSibling(), depth++);

Alberto

P.S. Given the type of navigation you are doing, have you considered using DOMNodeIterator?

-----Original Message-----
From: Nguyen, Vu [CAR:SI12:EXCH]
Sent: Thursday, February 24, 2005 9:14 AM
To: 'Alberto Massari (JIRA)'
Subject: RE: [jira] Commented: (XERCESC-1355) DOMBuilder parse wrong node type


Hi Alberto,
I already tried but not working. So I will attach them to this email.
I'd like to summarize here for more precision about potential error in my finding:
1) DOMBuilder did not build the node type correctly. It only set the all nodes to ELEMENT_NODE type.
2) DOMBuilder did not build the node correctly. For example, there is xml tag <help>"BulkInputService"</help> will result in two nodes:


The first of type ELEMENT_NODE whose name is help; ofcourse there is no value for it.
The second node that DOMBuilder inserted in of type TEXT_NODE, whose name is '#text' and its value is "BulkInputService" and added as a child node...


From the CLITree.cc
        just look at: parseCLIModel(xml file);
                    buildCLITree() and buildCLISubtree()

My hunch is something to do with the code to setup the DOMBuilder, and the actual xml, though well-formed and validated, has something to screwup the dom parser ....

Thanks a lot for your help,

I stuck with this code for about few days and sitting at very tight schedule. I would be appreciate your help a lot. Looking forward for your assistance. Don't hesitate to email me if need anything...

Thanks again
Vu Nguyen
(613) 768-2622

One more thing, the xerces-c lib is the binary distribution downloaded from your website for LINUX.

-----Original Message-----
From: Alberto Massari (JIRA) [<mailto:xerces-c-dev@xml.apache.org>mailto:[EMAIL PROTECTED]
Sent: Thursday, February 24, 2005 3:24 AM
To: [EMAIL PROTECTED]
Subject: [jira] Commented: (XERCESC-1355) DOMBuilder parse wrong node type


[ <http://issues.apache.org/jira/browse/XERCESC-1355?page=comments#action_59693>http://issues.apache.org/jira/browse/XERCESC-1355?page=comments#action_59693 ]

Alberto Massari commented on XERCESC-1355:
------------------------------------------

Could you attach the XML and the code you use to initialize the parser? It's hard for us to guess what's wrong here...

Alberto

> DOMBuilder parse wrong node type
> --------------------------------
>
> Key: XERCESC-1355
> URL: <http://issues.apache.org/jira/browse/XERCESC-1355>http://issues.apache.org/jira/browse/XERCESC-1355


>      Project: Xerces-C++
>         Type: Bug
>   Components: DOM
>     Versions: 2.6.0
>  Environment: Linux gcc 3.2 Redhat Linux 8.0 3.2-7
>     Reporter: Vu Nguyen

>
> Basically I wrote a simple code (similar to DOMCount) to printout the
> DOM tree content. I found out that all of the node type
> (node.getNodeType()) always return 3(which is ELEMENT_NODE) while it
> should sometimes return TEXT_NODE so I can obtain the value via
> node.getNodeValue(). As the result, I always get NULL. Not sure if related to this thing, before setFeature(...whitespace = true), the DOMTree has a lot of bogus TEXT_NODEs. ==================== OUTPUT LOG ========================= Building CLI tree from data model ...


> Element: command-groups
>         Attributes
>         ----------
>         id=_1
>         name=bulk-input
> Rootnode has child: 1
> Element: help = (null) with type 1
> Element: command = (null) with type 1
>         Attributes
>         ----------
>         id=_1
>         name=show
> Element: command = (null) with type 1
>         Attributes
>         ----------
>         id=_2
>         name=start
> Node type == 1
> Element: help and value (null) at 0
> Node type == 3
> Element: #text and value "BulkInputService" at 0
> we done
> =============================================================
> Note that: help is a text node and expected to return some value.
> Here the sample of xml and dtd.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:

<http://issues.apache.org/jira/secure/Administrators.jspa>http://issues.apache.org/jira/secure/Administrators.jspa

-
If you want more information on JIRA, or have a bug to report see:

<http://www.atlassian.com/software/jira>http://www.atlassian.com/software/jira








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