users@jaxb.java.net

Re: [BULK] xsd:any unmarshalled to DOM

From: Sparefroh <zwatte_at_gmx.net>
Date: Fri, 12 Oct 2007 07:58:11 -0700 (PDT)

Jeremiah Voris-2 wrote:
>
> Sparefroh <zwatte_at_gmx.net> wrote on 10/09/2007 10:12:09 AM:
> <snip>
>> Any ideas how to preserve these whitespaces between elements?
>
> Jeremiah Voris <JVoris_at_naverus.com> wrote on 10/09/2007 01:13:03 PM:
>> The only thing I can think of is to try adding the xml:space attribute
> to
>> your root element: <http://www.w3.org/TR/REC-xml/#sec-white-space>
>
> Sparefroh <zwatte_at_gmx.net> wrote on 10/10/2007 01:05:34 AM:
>> I tried this already but it didn't have any effect to the result :-/
>
> I did remember another attribute that I would expect to be necessary to
> get your desired effect: http://www.w3.org/TR/xmlschema-0/#mixedContent
>
> If I remember correctly, an anonymous <complexContent> element (which I
> assume you're using) defaults to element-only or, at least, a preference
> for that if there is no obvious indication that mixed="true" should be
> inferred. In other words, if you had non-whitespace I think the inference
> can be mixed="true" was intended rather than failing to validate the
> document, but white space is, by default, supposed to be considered
> unimportant unless explicitly indicated otherwise so it would not be
> something that would tell the parser to infer the attribute. So, for
> example, with the following I would be less surprised if the white space
> were not preserved:
>
> <rootElement xml:space="preserve">
> <complexContent>
>
> <things />
>
> <stuff />
>
> </complexContent>
> </rootElement>
>
> With this version, however, I would be more surprised (and displeased) if
> it were not preserved:
>
> <rootElement xml:space="preserve">
> <complexContent mixed="true">
>
> <things />
>
> <stuff />
>
> </complexContent>
> </rootElement>
>
> There you have explicitly stated that whatever is found within that tag is
> important, including space. If that doesn't work I'd consider it a bug. :)
>
> --
> Jeremiah
>

Hi,

I tried this now, but I am still facing the same problem.
This is the part out of my xsd schema:

<xs:complexType name="AnyChildrenType" mixed="true">
        <xs:sequence>
            <xs:any namespace="##any" processContents="lax">
            </xs:any>
        </xs:sequence>
</xs:complexType>

<xs:complexType name="XMLContentType">
        <xs:complexContent mixed="true">
            <xs:extension base="AnyChildrenType">
                <xs:attribute ref="xml:space" use="required"/>
            </xs:extension>
        </xs:complexContent>
</xs:complexType>

At the top I have an import statement for the xml-Namespace:
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>

Do you see any mistakes?
Thanks for your help!


-- 
View this message in context: http://www.nabble.com/xsd%3Aany-unmarshalled-to-DOM-tf4595588.html#a13176877
Sent from the java.net - jaxb users mailing list archive at Nabble.com.