pharo-contributions / XML-XMLParser

XML Parser for Pharo
MIT License
11 stars 17 forks source link

`Instance of XMLString did not understand #descendantElements` encountered while attempting to inspect empty list item in XMLNodeList #31

Closed capsulecorplab closed 4 months ago

capsulecorplab commented 9 months ago

Screenshot from 2024-01-19 02-08-14 Screenshot from 2024-01-19 02-09-03

capsulecorplab commented 9 months ago

Seems okay for inspecting list items containing an XMLElement Screenshot from 2024-01-19 02-13-29

astares commented 4 months ago

Reproducible with

|xmlString|
xmlString := '<?xml version="1.0" encoding="UTF-8"?>
<countries><country code="af" handle="afghanistan" continent="asia" iso="4">Afghanistan</country>
  <country code="al" handle="albania" continent="europe" iso="8">Albania</country>
  <country code="dz" handle="algeria" continent="africa" iso="12">Algeria</country>
</countries>'.

(XMLDOMParser parse: xmlString)
    document  root nodes 

The parse returns XMLString nodes for the empty parts.

capsulecorplab commented 4 months ago

Reproducible with

|xmlString|
xmlString := '<?xml version="1.0" encoding="UTF-8"?>
<countries><country code="af" handle="afghanistan" continent="asia" iso="4">Afghanistan</country>
  <country code="al" handle="albania" continent="europe" iso="8">Albania</country>
  <country code="dz" handle="algeria" continent="africa" iso="12">Algeria</country>
</countries>'.

(XMLDOMParser parse: xmlString)
  document  root nodes 

The parse returns XMLString nodes for the empty parts.

Thanks @astares! The fix seems to be working for me too. Might be worth updating https://github.com/pharo-contributions/XML-XMLParser?tab=readme-ov-file#how-to-use to also say document root nodes instead of document inspect? Screenshot from 2024-06-07 18-04-54 Screenshot from 2024-06-07 18-05-07

astares commented 4 months ago

Yes, you can send a PR