| Author |
any (<xs:any namespace="##any"/>)
|
|
| Zika Mustikla 2006-03-23, 6:15 am |
|
I have this schema:
<xs:element name="MyElement">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any"/>
</xs:sequence>
<xs:attribute name="Id" type="xs:ID" use="required"/>
</xs:complexType>
</xs:element>
well, the problem is that validation of this fails:
<MyElement>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</MyElement>
Why? What should I use instead of ##any?
| |
| George Bina 2006-03-23, 6:15 am |
| There are 3 problems here.
One is that your document that you try to validate is not XML as it is
not wellformed, you need to close the xsl:stylesheet element to have it
well formed.
<MyElement>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</MyElement>
The second problems is that xs:any contains an attribute
processContents that can have 3 possible values: strict, lax and skip.
By default its value is strict and that means that a schema for the
elements matched by xs:any must be provided. If you set its value to
lax or skip the xsl:stylesheet element will be accepted by the xs:any
wildcard.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MyElement">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax"/>
</xs:sequence>
<xs:attribute name="Id" type="xs:ID" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
The third problem is that your schema specified the Id attribute for
the MyElement as Required so your document is not valid, to have it
valid you either need to add the attribute in the instance document and
change the schema to not require that attribute.
Here there is a valid instance against the above schema:
<MyElement Id="e1">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</MyElement>
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
| |
| Zika Mustikla 2006-03-23, 6:15 am |
|
Thank you for your answers.
> The second problems is that xs:any contains an attribute
> processContents that can have 3 possible values: strict, lax and skip.
> By default its value is strict and that means that a schema for the
> elements matched by xs:any must be provided. If you set its value to
> lax or skip the xsl:stylesheet element will be accepted by the xs:any
> wildcard.
Is there XML Schema describing XSL ("xsl:stylesheet" and other XSL
elements).
| |
| George Bina 2006-03-23, 6:17 pm |
| I just replied you on the "XML Schema for XSL(T)?" thread.
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |