[squeak-dev] XMLDomParser (monty) comments not preserved

gettimothy gettimothy at zoho.com
Tue Sep 28 12:52:10 UTC 2021


Just an FYI to whom it may concern...









I am adding some complexity to the document from this source:



(((XMLDOMParser onURL: 'https://w1.weather.gov/xml/current_obs/index.xml' upToLimit:nil)

preservesCDataNodes: true;

preservesCommentNodes: true) parseDocument) explore.






CData and processing-instructions are being preserved, but comments are not.



example slice of the data I add is where you can see the <!--comment--> stuff:





  <s:station subs="yes">

   <?s:station-processing-instruction   type = "XYZ"?>

   <!--comment station XYZ-->

   <![CDATA[

      station XYZ CDATA

   ]]>

   <s:station_id>XYZ</s:station_id>

   <s:state>NZ</s:state>

   <s:station_name>XYZ_ONE</s:station_name>

   <s:latitude>51.76667</s:latitude>

   <s:longitude>-114.68333</s:longitude>

   <s:html_url>http://w1.weather.gov/data/obhistory/CWAV.html</s:html_url>

   <s:rss_url>http://weather.gov/xml/current_obs/CWAV.rss</s:rss_url>

   <s:xml_url>http://weather.gov/xml/current_obs/CWAV.xml</s:xml_url>

   <s:substations>

    <s:substation location="north">

      <!--comment station XYZ1-->

      <s:station_id>XYZ1</s:station_id>

      <s:state>NZ</s:state>

      <s:station_name>XYZ_SUB_ONE</s:station_name>

    </s:substation>

    <s:substation location="northeast">

      <s:station_id>XYZ2</s:station_id>

      <s:state>NZ</s:state>

      <s:station_name>XYZ_SUB_TWO</s:station_name>

      <!--comment station XYZ2-->

    </s:substation>

    <s:substation location="east">

      <s:station_id>XYZ3</s:station_id>

      <s:state>NZ</s:state>

      <s:station_name>XYZ_SUB_THREE</s:station_name>

      <!--comment station XYZ3-->

    </s:substation>

    <s:substation location="south">

      <s:station_id>XYZ4</s:station_id>

      <s:state>NZ</s:state>

      <s:station_name>XYZ_SUB_FOUR</s:station_name>

      <!--comment station XYZ4-->

    </s:substation>

    <s:substation  location="west">

      <s:station_id>XYZ5</s:station_id>

      <s:state>NZ</s:state>

      <s:station_name>XYZ_SUB_FIVE</s:station_name>

      <!--comment station XYZ5-->

    </s:substation>

   </s:substations>

  </s:station>
The intent is to provide practice and examples on more complex axis:node-test[parameter]*   paths in the Help/Documentation I am writing.



Of these three XPath...only the comment does not work:
    self xpath:'/child::node()/child::s:wx_station_index/child::s:station[position()=1]/child::processing-instruction()'.    a XPathNodeSet(<?s:station-processing-instruction type = "ABC"?>)

    self xpath:'/child::node()/child::s:wx_station_index/child::s:station[position()=1]/child::comment()'.    a XPathNodeSet()

    self xpath:'/child::node()/child::s:wx_station_index/child::s:station[position()=1]/child::text()'. a XPathNodeSet(

   

  

  

      station ABC CDATA

  

   

   

   

   

   

   

   

   

   

  )

   







again, just an FYI.



thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210928/5386cfe4/attachment.html>


More information about the Squeak-dev mailing list