[XML-SIG] How can I search for a string of text
Thu, 22 Apr 1999 11:10:37 -0400
normalize... haven't tried that one before. Sounds like it might do the trick.
The string in question should not have any entities or elements mixed into it so
I don't need to worry about that. I'll give it a shot.
>I need to remove a string from my HTML files but I don't know the best way to
>find it. There are usually line feeds in the HTML between the string so the
>string does not appear as one DOM text node. Does anyone know the best way to
>find contiguous text that spans multiple DOM nodes?
>"Andrew M. Kuchling" <firstname.lastname@example.org> writes:
> The normalize() method on an Element node consolidates the
>subtree so there are no adjacent Text nodes, merging Text nodes that
>are next to each other into a single node. So you could do
>document.rootElement.normalize(), and then rely on the string being
>contained within one node. That won't catch tricky cases -- do you
>need to find it if an entity expands to the string, or to part of the
>string? if the string had a PI in the middle of it, would it still
>count as a match? -- but it'll certainly help with the simple case.