P
P
Pavel_Proca2017-07-19 17:22:44
JavaScript
Pavel_Proca, 2017-07-19 17:22:44

How to search for words in XML using javascript?

Text is entered in the input field. How to do a keyup search in XML, and display the elements in which the words entered in the input were found? Some keyword search from XML

<item>
     <name>First item</name>
     <id>1</id>
     <keywords>this, item, red, color</keywords>
</item>
<item>
     <name>Second item</name>
     <id>2</id>
     <keywords>javascript, html, xml</keywords>
</item>
<item>
     <name>Third item</name>
     <id>3</id>
     <keywords>toster, ru</keywords>
</item>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2017-07-19
@Pavel_Proca

Elements can be iterated simply in a loop, I gave links to descriptions of how to interact with XML in the comments, and matches can be searched like this . It will be possible to say in more detail only knowing what exactly you may have problems with.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question