|
Aaron Bartell wrote:
>
> >No - not yet. It makes the assumption that the XML is well-formed and
> valid. Although if there are missing/extra elements/attributes you can deal
> with it.
>
> Just want a little clarification on this one because I don't know what they
> are using under the covers (assuming Xerces). A parser (usually) _does_ care
> about well-formed and will throw errors (with column and line number) if not
> well formed.
>
> Did you mean to say that it assumes the XML meets the constraint criteria of
> whatever schema/dtd it represents? So even though a <order> tag might
> require one <item> element based on the schema (XSD), the parser could care
> less.
>
The parser simply requires that the XML be well-formed.
It's a non-validating parser, so schemas or DTDs are irrelevant to it.
RPG's XML-INTO operation does put a constraint on the XML: that the XML
conform to the RPG variable. For example, if you specify a data
structure INFO with subfields IDNO and ADDRESS, the default behaviour of
XML-INTO is that the XML document is expected to have the document
element named "info", with two children (either elements or attributes),
one named "idno" and one named "address".
D info ds
D addr 100a
D idno 5p 0
/free
xml-into info %xml(xmldoc);
This XML-INTO statement requires the XML document be something like
this:
<info idno="1350">
<addr>Whatever</addr>
</info>
or this
<info>
<addr>Whatever</addr>
<idno>12345</idno>
</info>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.