Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Nested XML-Schemas

From: "Günter Prossliner" <g.prossliner/gmx/at>
To: NULL
Date: 4/1/2007 5:28:00 PM

Hi Priya!

Thank you very much for your answer! My comments are inline.


> If you want to use two schemas (that dont import or include each
> other) in your instance, you can add
> xsi:schemaLocation/xsi:noNamespaceSchemaLocation attributes to your
> instance element and refer them directly.

According to http://www.w3.org/TR/xmlschema-1/ I cannot see how these 
attributes may help me in my case. Or do I understand something wrong?


> But from your example, it looks like you want to allow an element in a
> second schema in the content model of the first even though the first
> schema has no knowledge of the second. This is possible only through
> the use of xs:any (wildcards in the content model).
>
> In your sample, if the definition of s1:e1 had been as follows, then
> validation will succeed:
>    <xs:element name="el1">
>     <xs:complexType>
>      <xs:sequence>
>       <xs:element name="el2" minOccurs="0"/>
>       <xs:any namespace="urn:sample2" processContents="lax"
>      minOccurs="0"/> </xs:sequence>
>     </xs:complexType>
>    </xs:element>

I am already using xs:any for one direction (just the way that the XSLT 
Schema uses it to allow any tags inside it's own tags). Allthough using it 
for the other direction (to allow that XSLT Elements can be put anywhere in 
the ouput - namespace) would be not practicable to design the Schema 
differently just for the fact that an XML based upon it will be generated by 
XSLT.

I use XSLT to point this out, because my Schema is very the same as XSLT 
(FXI: it an XML-based transformation language that transforms managed 
Objects into text (or xml), the syntax is allmost identical to XSLT).

It seems like VS.Net (or XML generally?) used other validation rules for 
XSL-Transformation Scripts.


The example from my first posting points this out:

>> <xsl:stylesheet version="2.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> xmlns:out="urn:sample"
>>>
>>
>>  <xsl:template match="/">
>>    <out:root>
>>      <out:el1>
>>      <xsl:element name="el2" />
>>      </out:el1>
>>    </out:root>
>>  </xsl:template>
>>
>> </xsl:stylesheet>

Allthough "xsl:element" is not defined within the Schema "urn:sample",
VS.Net validates this correctly.

When I do exactly the same with my Schema, I get the Validation Error. Even
if I take the XSLT - Schema that VS.Net uses (taken from the {PF}\Visual
Studio\XML\Schema directory), just changing the Namespace from
"http://www.w3.org/1999/XSL/Transform" to e.g. "urn:test", and changing the
XML to

>> <xsl:stylesheet version="2.0"
>> xmlns:xsl="urn:test"
>> xmlns:out="urn:sample"
>>>
>>
>>  <xsl:template match="/">
>>    <out:root>
>>      <out:el1>
>>      <xsl:element name="el2" />
>>      </out:el1>
>>    </out:root>
>>  </xsl:template>
>>
>> </xsl:stylesheet>

I get a Validation Error saying "'element' from 'urn:test'" is no valid
child-element of 'el1' from 'urn:sample'".

This makes me think, that XSLT is threaded somehow special in VS.Net (or in
XML at all?) to avoid that any XML that is generated with XSLT cannot be
validated.

So: Is there any chance to register my Schema within VS.Net that the same -
XST like - validation-behavior?




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent