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 "Rick O'Shea (JIRA)" <xe...@xml.apache.org> on 2007/03/28 19:41:25 UTC

[jira] Created: (XERCESC-1690) endElement called before startElement

endElement called before startElement
-------------------------------------

                 Key: XERCESC-1690
                 URL: https://issues.apache.org/jira/browse/XERCESC-1690
             Project: Xerces-C++
          Issue Type: Bug
          Components: Validating Parser (DTD)
    Affects Versions: 2.7.0
         Environment: Fedora Core 1 - 6
GCC
            Reporter: Rick O'Shea
            Priority: Minor


I have derived a new parser class from XercesDOMParser, and overridden the startElement & endElement callbacks.

All seems well...except I have noticed that when my XML contains empty-element tags "/>" ...

eg.  <element name=value />

...the endElement callback is called first!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Reopened: (XERCESC-1690) endElement called before startElement

Posted by "Rick O'Shea (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick O'Shea reopened XERCESC-1690:
----------------------------------


Sorry for reopening this...but I really am still seeing an issue here.

In my overridden startElement & endElement code, I output some simple debug text to inform me about which xml element it is parsing.

When I have xml such as this:

      <aNode name="main">
        <event name="repair" />
      </aNode>

...the debug output tells me:

startElement : aNode
endElement : event
startElement : event
endElement : aNode

I am aware of the isEmpty flag, but this still does not explain the bizarre premature call to endElement. As it happens, this is not critical to my code, hence the "minor" priority  :-)  But it is certainly not the behavior I would expect.

> endElement called before startElement
> -------------------------------------
>
>                 Key: XERCESC-1690
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1690
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (DTD)
>    Affects Versions: 2.7.0
>         Environment: Fedora Core 1 - 6
> GCC
>            Reporter: Rick O'Shea
>            Priority: Minor
>
> I have derived a new parser class from XercesDOMParser, and overridden the startElement & endElement callbacks.
> All seems well...except I have noticed that when my XML contains empty-element tags "/>" ...
> eg.  <element name=value />
> ...the endElement callback is called first!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (XERCESC-1690) endElement called before startElement

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-1690.
--------------------------------------

    Resolution: Invalid

Hi Rick,
what you are seeing is that startElement is invoked with the isEmpty argument set to true; in this case, endElement for that node is not invoked.

Alberto

> endElement called before startElement
> -------------------------------------
>
>                 Key: XERCESC-1690
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1690
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (DTD)
>    Affects Versions: 2.7.0
>         Environment: Fedora Core 1 - 6
> GCC
>            Reporter: Rick O'Shea
>            Priority: Minor
>
> I have derived a new parser class from XercesDOMParser, and overridden the startElement & endElement callbacks.
> All seems well...except I have noticed that when my XML contains empty-element tags "/>" ...
> eg.  <element name=value />
> ...the endElement callback is called first!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESC-1690) endElement called before startElement

Posted by "Rick O'Shea (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESC-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485184 ] 

Rick O'Shea commented on XERCESC-1690:
--------------------------------------

Thank you for your insight Alberto  :-)  This confirmation is a great help to me!

> endElement called before startElement
> -------------------------------------
>
>                 Key: XERCESC-1690
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1690
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (DTD)
>    Affects Versions: 2.7.0
>         Environment: Fedora Core 1 - 6
> GCC
>            Reporter: Rick O'Shea
>            Priority: Minor
>
> I have derived a new parser class from XercesDOMParser, and overridden the startElement & endElement callbacks.
> All seems well...except I have noticed that when my XML contains empty-element tags "/>" ...
> eg.  <element name=value />
> ...the endElement callback is called first!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (XERCESC-1690) endElement called before startElement

Posted by "Alberto Massari (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-1690.
--------------------------------------

    Resolution: Invalid

Sorry for the incorrect answer (I was mistakenly thinking you were using the SAX handlers); if you are overriding the XercesDOMParser you should be aware that its startElement callback will call the endElement callback if the isEmpty flag is set to true (because the engine will not invoke endElement in that case).
So if your derived method is first invoking the base class and then printing the debug statement you will see the endElement trace printed before the startElement one.

If your own code needs to be execute after the base class has created the DOM node, but before the endElement has been executed, be sure to invoke the base class with isEmpty=false, and then, if the original isEmpty is true, manually invoke endElement


> endElement called before startElement
> -------------------------------------
>
>                 Key: XERCESC-1690
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1690
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (DTD)
>    Affects Versions: 2.7.0
>         Environment: Fedora Core 1 - 6
> GCC
>            Reporter: Rick O'Shea
>            Priority: Minor
>
> I have derived a new parser class from XercesDOMParser, and overridden the startElement & endElement callbacks.
> All seems well...except I have noticed that when my XML contains empty-element tags "/>" ...
> eg.  <element name=value />
> ...the endElement callback is called first!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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