xmlxml-namespacesfuzzingpeach

Peach fails when I use the attribute xmlns


I want to create Peach DataModel which would fuzzy XML (To be precise, the [Content_Types].xml from .docx). But when I create a XmlElement attribute xmlns, then peach crashes with Unhandled Exception: System.ArgumentException

It works:

<DataModel name="TestTemplate">
        <XmlElement elementName="Types">
                <XmlAttribute attributeName="xmlnsSOMELETTERS">
                        <String value="http://schemas.openxmlformats.org/package/2006/content-types">
                        <Analyzer class="StringToken"/>
                        </String>
                </XmlAttribute>
.......
</DataModel>

It not works:

<XmlElement elementName="Types">
                <XmlAttribute attributeName="xmlns">
                        <String value="http://schemas.openxmlformats.org/package/2006/content-types">
                        <Analyzer class="StringToken"/>
                        </String>
                </XmlAttribute>

Can you help me with this?

Full xml


Solution

  • As @Tomalak mentioned in comments, xmlns isn't an attribute but a namespace declaration, so you have to handle it differently.

    In Peach, there is a special attribute (ns) on XmlElement to use for namespace declarations.