in reply to Re^3: XML::Compile template initialized from XML document
in thread XML::Compile template initialized from XML document

Following up. Are you suggesting that the reader is producing the tree of objects instead of a hash of hashes because the schema is mixed? In other words, the library knows it can't render a mixed schema as a hash of hashes and that is why it doesn't?

I'm not going to wait for your answer. Because I know the schema doesn't have to have mixed elements, I'm going to make a local file copy of the schema, change it so mixed is "false" and see what I get. But I would welcome anyone's input on this while I do that work. Thanks!

  • Comment on Re^4: XML::Compile template initialized from XML document

Replies are listed 'Best First'.
Re^5: XML::Compile template initialized from XML document
by tdane (Acolyte) on May 12, 2016 at 21:08 UTC

    Now replying to myself! I made a local copy of the schema and changed all the mixed="true" to "false." This revealed one other problem: an element that needed a minOccurs="0". I added that and now my XML parses into a lovely and very perl-ish hash of hashes and arrays!

    The good news is that I am able to contact the developers and suggest the schema be changed along these lines. In the meantime I can proceed with my local version of the schema.

    Thank you to all the monks who helped! markov in particular gave me the clue that got me to a solution.

Re^5: XML::Compile template initialized from XML document
by markov (Scribe) on May 12, 2016 at 23:12 UTC

    In some cases, mixed elements are necessary: for instance when a XHTML document is included inside a structured XML message. But often, mixed elements are abused when the schema author wanted "free format XML" because it was too hard to specify or laziness.

    So, the mixed_elements option can be used in what way XML::Compile will help you deal with these tricks. More like XML::Simple style parsing of the mixed element. That usually works out.

    The effect of your modification is probably the same as specifing mixed_elements => 'STRUCTURAL' when compiling a reader.

    minOccur errors are common. Sometimes, I see confusion between nillable and optional... there is a flag for that as well: interpret_nillable_as_optional