Question about Soup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about Soup

CyrilFerlicot
Hi!

I needed to query some things inside some XML and I saw Soup in the
catalog.

I was a little surprise to find no method to get elements by their id.
This is one of the two common way to get elements in HTML.

Is there a reason for not having a #findTagById:? If not, can add it?

--
Cyril Ferlicot

http://www.synectique.eu

2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France


signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Question about Soup

monty-3
If you're parsing XML, you can use XMLParser's XMLDOMParser and use #findElementWithID: to find the first element (starting with the receiver) that has the given ID. It identifies ID attributes as any attribute whose ATTLIST DTD declaration has type "ID" (this now works with or without validation enabled) or if it's named "xml:id".

> Sent: Saturday, January 07, 2017 at 8:26 PM
> From: "Cyril Ferlicot D." <[hidden email]>
> To: Pharo <[hidden email]>
> Subject: [Pharo-dev] Question about Soup
>
> Hi!
>
> I needed to query some things inside some XML and I saw Soup in the
> catalog.
>
> I was a little surprise to find no method to get elements by their id.
> This is one of the two common way to get elements in HTML.
>
> Is there a reason for not having a #findTagById:? If not, can add it?
>
> --
> Cyril Ferlicot
>
> http://www.synectique.eu
>
> 2 rue Jacques Prévert 01,
> 59650 Villeneuve d'ascq France
>
>