Opened 18 years ago
Closed 18 years ago
#111 closed defect (fixed)
Genshi strips XML namespace declaration
Reported by: | Alec Thomas <alec@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.4.1 |
Component: | Parsing | Version: | 0.3.6 |
Keywords: | Cc: |
Description
Given the input:
<?xml version="1.0" encoding="utf-8"?> <root />
Genshi currently produces:
<root />
This is because the XML namespace is distinct from processing instructions, thus Expat has a distinct callback for it. This callback is not currently handled by Genshi.
Patch attached which adds an XML_DECL type, which effectively just contains the values passed through from Expat. eg.
XML_DECL (u'1.0', u'utf-8', 1) ('feed.xml', 1, 0)
Outputs as:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
I didn't add XPath support for it, as apparently it's not a valid node (this is the only reference that I could find in the spec').
(Note that Expat doesn't appear to generate text elements between the XML decl and the first element, so the unit tests explicitly use \n)
Attachments (1)
Change History (2)
Changed 18 years ago by Alec Thomas <alec@…>
comment:1 Changed 18 years ago by cmlenz
- Milestone set to 0.4.1
- Resolution set to fixed
- Status changed from new to closed
Patch adding support for the XML declaration