Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Nested XML-Schemas [Thread Next] Re: Nested XML-SchemasTo: 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? | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
