-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
p5.XML.listChildren()
inserts #text
unexpectedly
#7047
Comments
Hi, I found the bug, If you run this correct code in here it works, I just did changes without setting up the code in my machine.
let myXML; // Load the XML and create a p5.XML object. function listChildren(xml) { function setup() { // Get the names of the element's children as an array. // Print the array to the console.
|
If you want to do full code changes in repository you need to make changes in these places.
correct code : listChildren(xml) {
correct code : function setup() { // Get the names of the element's children as an array. // Print the array to the console. |
👋 I suspect the suggested solution of checking for I did read through the contributor docs, but I am new to this codebase and contributing community so apologies if I'm not following protocol in some way. |
Simply filtering out <?xml version="1.0"?>
<animals>
There are 4 animals here.
<mammal id="0" species="Capra hircus">Goat</mammal>
<mammal id="1" species="Panthera pardus">Leopard</mammal>
<mammal id="2" species="Equus zebra">Zebra</mammal>
<reptile id="3" species="Caretta caretta">Turtle</reptile>
</animals> One would expect the A possible way is to only ignore |
@limzykenneth thanks for the link and explanation about the string being considered a child. So with Based on the language used in the Reference docs, it seems like only elements should be included as children.
How I understand the description, I do not expect that calling the method on this
will include "There are 4 animals here" in the returned array. What's your take on the description and the intended behavior of the method? |
@raquelcps For me, Regardless, in terms of utility, I do think having |
Most appropriate sub-area of p5.js?
p5.js version
1.9.3
Web browser and version
Chrome 124.0.6367.208
Operating system
macOS 14.4.1
Steps to reproduce this
Steps:
myXML.listChildren()
.Snippet:
Here's the sketch for reference.
The text was updated successfully, but these errors were encountered: