[xsde-users] Re: Why xml_schema::schema exception is thrown when the xml document is not well formed

Boris Kolpackov boris at codesynthesis.com
Mon Oct 29 13:59:54 EDT 2007


Hi Bin,

Jiang, Bin (Bin) <binjiang at alcatel-lucent.com> writes:

> In this case, why the column number is not the beginning of the
> line, but is 34, the end of the line?

That's how the underlying XML parser (Expat) works. If you query
the column after the event has been triggered, you get the value
that points at the end of content that triggered the event.


> When the characters would be ignored by the parser?

One way to achieve this would be to declare your type as having
mixed content (add mixed="true" attribute). The text content
will be delivered to the _any_characters() hook which by default
does nothing.


>        <xsd:complexType name="identityType">
>            <xsd:complexContent>
>                <xsd:restriction base="xsd:anyType">
>                    <xsd:choice maxOccurs="unbounded">
>                        <xsd:element name="one" type="xsd:string"/>
>                        <xsd:element name="two" type="xsd:string" minOccurs="0"/>
>                    </xsd:choice>
>                </xsd:restriction>
>            </xsd:complexContent>
>        </xsd:complexType>
>
> And find characters inside "identityType" element would be ignored, is
> this because the "identityType" type is derived from "xsd:anyType"?

Hm, the characters should still be flagged as error. I guess you just
found a bug! We will try to fix it for the next release.

Boris





More information about the xsde-users mailing list