[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
are the regular expressions over xml structure?
- From: Oleg Parashchenko <olpa@uucode.com>
- To: xml-dev@lists.xml.org
- Date: Fri, 29 Jun 2012 10:52:00 +0200
Hello,
are there libraries to work with XML structure using regular expressions?
Something like this, in pseudocode:
rx = xml_re.compile('''(h1, (not h1)*)''')
rx.sub('''<section>\0</section>''', xml_doc)
If the content of xml_doc was
<x>
<h1>Heading 1</h1>
<p>text 1</p>
<p>text 2</p>
<h1>Heading 2</h1>
<p>text 3</p>
</x>
then the substitution should result in:
<x>
<section>
<h1>Heading 1</h1>
<p>text 1</p>
<p>text 2</p>
</section>
<section>
<h1>Heading 2</h1>
<p>text 3</p>
</section>
</x>
Any hints are welcome!
--
Oleg Parashchenko olpa@ http://uucode.com/
http://uucode.com/blog/ XML, TeX, Python, Mac, Chess
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]