modified parsing of <list>, <union>, <restriction>, <sequence>, <choice>,

* xmlschemas.c: modified parsing of <list>, <union>, <restriction>,
  <sequence>, <choice>, <include>, <import>.
  Fixed schema defaults (elementFormDefault, etc.) for included
  schemas.
  Fixed a bug which reported attributes as invalid on
  elements declarations with the built-in type 'anyType'.
  Added "lax" validation of the content of elements of type
  'anyType'.
  Fixed: element declarations with the same name were treated
  as duplicate if located in the subtree of <choice> -> <sequence>.
  (This was bug 150623, submitted by Roland Lezuo)
  Fixed cleanup of error codes in xmlSchemaValidateDoc as proposed
  by Igor Kapitanker. (This was bug 150647, submitted by Igor
  Kapitanker)
* xmlschemastypes.c: Changed the type of anyType to
  XML_SCHEMAS_ANYTYPE.
* include/libxml/xmlerror.h: Added schema parser errors.
* result/schemas/bug145246_0_0*
  result/schemas/extension1_0_2.err: Changed test results.
* result/schemas/ct-sc-nobase_0_0*
  result/schemas/facet-whiteSpace_0_0*
  result/schemas/import1_0_0* result/schemas/import2_0_0*
  result/schemas/include2_0_0* result/schemas/include3_0_0*
  result/schemas/restriction-attr1_0_0*
  result/schemas/seq-dubl-elem1_0_0*
  result/schemas/xsd-list-itemType_0_0*: Added new rest results.
  test/schemas/bug145246.xsd.imp test/schemas/ct-sc-nobase_0*
  test/schemas/facet-whiteSpace_0* test/schemas/import1_0*
  test/schemas/import2_0* test/schemas/include2_0*
  test/schemas/include3_0* test/schemas/restriction-attr1_0*
  test/schemas/seq-dubl-elem1_0* test/schemas/xml.xsd
  test/schemas/xsd-list-itemType_0*: Added new tests and missing
  files.
This commit is contained in:
William M. Brack 2004-08-20 23:09:47 +00:00
parent dab93ea749
commit 2f2a66324d
51 changed files with 2555 additions and 956 deletions

View File

@ -1,3 +1,39 @@
Sat Aug 21 0:035:10 CET 2004 Kasimier Buchcik <libxml2-cvs@cazic.net>
* xmlschemas.c: modified parsing of <list>, <union>, <restriction>,
<sequence>, <choice>, <include>, <import>.
Fixed schema defaults (elementFormDefault, etc.) for included
schemas.
Fixed a bug which reported attributes as invalid on
elements declarations with the built-in type 'anyType'.
Added "lax" validation of the content of elements of type
'anyType'.
Fixed: element declarations with the same name were treated
as duplicate if located in the subtree of <choice> -> <sequence>.
(This was bug 150623, submitted by Roland Lezuo)
Fixed cleanup of error codes in xmlSchemaValidateDoc as proposed
by Igor Kapitanker. (This was bug 150647, submitted by Igor
Kapitanker)
* xmlschemastypes.c: Changed the type of anyType to
XML_SCHEMAS_ANYTYPE.
* include/libxml/xmlerror.h: Added schema parser errors.
* result/schemas/bug145246_0_0*
result/schemas/extension1_0_2.err: Changed test results.
* result/schemas/ct-sc-nobase_0_0*
result/schemas/facet-whiteSpace_0_0*
result/schemas/import1_0_0* result/schemas/import2_0_0*
result/schemas/include2_0_0* result/schemas/include3_0_0*
result/schemas/restriction-attr1_0_0*
result/schemas/seq-dubl-elem1_0_0*
result/schemas/xsd-list-itemType_0_0*: Added new rest results.
test/schemas/bug145246.xsd.imp test/schemas/ct-sc-nobase_0*
test/schemas/facet-whiteSpace_0* test/schemas/import1_0*
test/schemas/import2_0* test/schemas/include2_0*
test/schemas/include3_0* test/schemas/restriction-attr1_0*
test/schemas/seq-dubl-elem1_0* test/schemas/xml.xsd
test/schemas/xsd-list-itemType_0*: Added new tests and missing
files.
Fri Aug 20 18:51:36 CEST 2004 Daniel Veillard <daniel@veillard.com>
* Makefile.am configure.in: a bit of cleanup and a extra variable for

View File

@ -689,7 +689,19 @@ typedef enum {
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
XML_SCHEMAP_NO_XMLNS, /* 3056 */
XML_SCHEMAP_NO_XSI /* 3057 */
XML_SCHEMAP_NO_XSI, /* 3057 */
XML_SCHEMAP_COS_VALID_DEFAULT_1,
XML_SCHEMAP_COS_VALID_DEFAULT_2_1,
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1,
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2,
XML_SCHEMAP_CVC_SIMPLE_TYPE,
XML_SCHEMAP_COS_CT_EXTENDS_1_1,
XML_SCHEMAP_SRC_IMPORT_1_1,
XML_SCHEMAP_SRC_IMPORT_1_2,
XML_SCHEMAP_SRC_IMPORT_2,
XML_SCHEMAP_SRC_IMPORT_2_1,
XML_SCHEMAP_SRC_IMPORT_2_2
} xmlParserErrors;
/**
@ -707,12 +719,12 @@ typedef void (*xmlGenericErrorFunc) (void *ctx,
/**
* xmlStructuredErrorFunc:
* @userData: user provided data for the error callback
* @xmlerr: the error being raised.
* @error: the error being raised.
*
* Signature of the function to use when there is an error and
* the module handles the new error reporting mechanism.
*/
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr xmlerr);
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
/*
* Use the following function to reset the two global variables

View File

@ -644,56 +644,6 @@ Class xmlDoc(xmlNode)
# functions from module xpointer
xpointerNewContext()
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlAttribute(xmlNode)
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlElement(xmlNode)
Class xmlAttr(xmlNode)
@ -712,100 +662,12 @@ Class xmlAttr(xmlNode)
# functions from module valid
removeID()
removeRef()
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlReg()
# functions from module xmlregexp
regexpExec()
regexpIsDeterminist()
regexpPrint()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class Schema()
# functions from module xmlschemas
schemaDump()
schemaNewValidCtxt()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgValidCtxt()
# functions from module relaxng
@ -814,73 +676,6 @@ Class relaxNgValidCtxt()
relaxNGValidatePopElement()
relaxNGValidatePushCData()
relaxNGValidatePushElement()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class parserCtxt(parserCtxtCore)
@ -988,6 +783,94 @@ Class xmlDtd(xmlNode)
dtdElementDesc()
dtdQAttrDesc()
dtdQElementDesc()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGParse()
relaxParserSetFlag()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class SchemaParserCtxt()
# functions from module xmlschemas
schemaParse()
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlNs(xmlNode)
@ -1011,48 +894,6 @@ Class xmlNs(xmlNode)
# functions from module xpathInternals
xpathNodeSetFreeNs()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGParse()
relaxParserSetFlag()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()
Class SchemaParserCtxt()
# functions from module xmlschemas
schemaParse()
Class SchemaValidCtxt()
# functions from module xmlschemas
schemaValidateDoc()
Class xmlTextReaderLocator()
# functions from module xmlreader
@ -1083,3 +924,162 @@ Class URI()
parseURIReference()
printURI()
saveUri()
Class xmlAttribute(xmlNode)
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlElement(xmlNode)
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class Schema()
# functions from module xmlschemas
schemaDump()
schemaNewValidCtxt()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class SchemaValidCtxt()
# functions from module xmlschemas
schemaValidateDoc()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()

View File

@ -0,0 +1 @@
./test/schemas/bug145246_0.xml validates

View File

@ -1,3 +0,0 @@
I/O warning : failed to load external entity "test/schemas/bug145246.xsd.imp"
Schemas parser error : xmlSchemaParse: could not load 'test/schemas/bug145246.xsd.imp'.
Schemas parser error : Failed to import schema from location "test/schemas/bug145246.xsd.imp".

View File

@ -0,0 +1 @@
./test/schemas/ct-sc-nobase_0.xml validates

View File

View File

@ -1 +1 @@
./test/schemas/extension1_2.xml:1: element title: Schemas validity error : Element children are not allowed, because the content type is a simple type.
./test/schemas/extension1_2.xml:1: element title: Schemas validity error : Element 'title' [CT local]: Element content is not allowed, because the content type is a simple type.

View File

@ -0,0 +1 @@
./test/schemas/facet-whiteSpace_0.xml validates

View File

View File

View File

@ -0,0 +1,4 @@
I/O warning : failed to load external entity "test/schemas/import-bad-1_0.imp"
./test/schemas/import1_0.xsd:10: element import: Schemas parser error : Element 'import': Failed to parse the resource 'test/schemas/import-bad-1_0.imp' for import.
I/O warning : failed to load external entity "test/schemas/import1_0bc.imp"
./test/schemas/import1_0.xsd:12: element import: Schemas parser error : Element 'import': Failed to parse the resource 'test/schemas/import1_0bc.imp' for import.

View File

@ -0,0 +1 @@
./test/schemas/import2_0.xml validates

View File

View File

@ -0,0 +1 @@
./test/schemas/include2_0.xml validates

View File

View File

View File

@ -0,0 +1 @@
./test/schemas/include3_0.xsd:7: element element: Schemas parser error : Element 'element': A global element declaration with the name 'bar' does already exist.

View File

View File

@ -0,0 +1 @@
./test/schemas/restriction-attr1_0.xsd:5: element complexType: Schemas parser error : CT local, attr. use {'barA'}: The 'optional' use is inconsistent with a matching 'required' use of the base type.

View File

@ -0,0 +1 @@
./test/schemas/seq-dubl-elem1_0.xml validates

View File

View File

@ -0,0 +1 @@
./test/schemas/xsd-list-itemType_0.xml validates

View File

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://purl.org/dc/elements/1.1/"
targetNamespace="http://purl.org/dc/elements/1.1/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
DCMES 1.1 XML Schema
XML Schema for http://purl.org/dc/elements/1.1/ namespace
Created 2003-04-02
Created by
Tim Cole (t-cole3@uiuc.edu)
Tom Habing (thabing@uiuc.edu)
Jane Hunter (jane@dstc.edu.au)
Pete Johnston (p.johnston@ukoln.ac.uk),
Carl Lagoze (lagoze@cs.cornell.edu)
This schema declares XML elements for the 15 DC elements from the
http://purl.org/dc/elements/1.1/ namespace.
It defines a complexType SimpleLiteral which permits mixed content
and makes the xml:lang attribute available. It disallows child elements by
use of minOcccurs/maxOccurs.
However, this complexType does permit the derivation of other complexTypes
which would permit child elements.
All elements are declared as substitutable for the abstract element any,
which means that the default type for all elements is dc:SimpleLiteral.
</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml.xsd">
</xs:import>
<!--http://www.w3.org/2001/03/xml.xsd-->
<xs:complexType name="SimpleLiteral">
<xs:annotation>
<xs:documentation xml:lang="en">
This is the default type for all of the DC elements.
It permits text content only with optional
xml:lang attribute.
Text is allowed because mixed="true", but sub-elements
are disallowed because minOccurs="0" and maxOccurs="0"
are on the xs:any tag.
This complexType allows for restriction or extension permitting
child elements.
</xs:documentation>
</xs:annotation>
<xs:complexContent mixed="true">
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:any processContents="lax" minOccurs="1" maxOccurs="2"/>
</xs:sequence>
<xs:attribute ref="xml:lang" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="any" type="SimpleLiteral" abstract="true"/>
<xs:element name="title" substitutionGroup="any"/>
<xs:element name="creator" substitutionGroup="any"/>
<xs:element name="subject" substitutionGroup="any"/>
<xs:element name="description" substitutionGroup="any"/>
<xs:element name="publisher" substitutionGroup="any"/>
<xs:element name="contributor" substitutionGroup="any"/>
<xs:element name="date" substitutionGroup="any"/>
<xs:element name="type" substitutionGroup="any"/>
<xs:element name="format" substitutionGroup="any"/>
<xs:element name="identifier" substitutionGroup="any"/>
<xs:element name="source" substitutionGroup="any"/>
<xs:element name="language" substitutionGroup="any"/>
<xs:element name="relation" substitutionGroup="any"/>
<xs:element name="coverage" substitutionGroup="any"/>
<xs:element name="rights" substitutionGroup="any"/>
<xs:group name="elementsGroup">
<xs:annotation>
<xs:documentation xml:lang="en">
This group is included as a convenience for schema authors
who need to refer to all the elements in the
http://purl.org/dc/elements/1.1/ namespace.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="any"/>
</xs:choice>
</xs:sequence>
</xs:group>
<xs:complexType name="elementContainer">
<xs:annotation>
<xs:documentation xml:lang="en">
This complexType is included as a convenience for schema authors who need to define a root
or container element for all of the DC elements.
</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:group ref="elementsGroup"/>
</xs:choice>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO ct-sc-nobase_0.xsd"/>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO"
xmlns:foo="http://FOO">
<xsd:complexType name="base">
<xsd:simpleContent>
<xsd:extension base="xsd:string"/>
</xsd:simpleContent>
</xsd:complexType>
<xsd:element name="foo">
<xsd:complexType>
<xsd:simpleContent>
<xsd:restriction base="foo:base">
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<foo xmlns="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO facet-whiteSpace_0.xsd">hmmm
f f ff f
</foo>

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO" xmlns="http://FOO">
<xsd:element name="foo">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="replace"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://BAR">
<xsd:element name="bar.A"/>
</xsd:schema>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This one tests the document access strategy for <import> -->
<foo:foo
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO import1_0.xsd">
<foo:bar/>
<bar:bar.A/>
<bar:bar.B/>
</foo:foo>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<!-- This one tests the document access strategy for <import> -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
elementFormDefault="qualified">
<xsd:import namespace="http://BAR" />
<!-- This document is not a XML schema document. -->
<xsd:import namespace="http://BAR" schemaLocation="import-bad-1_0.imp" />
<!-- This document does not exist. -->
<xsd:import namespace="http://BAR" schemaLocation="import1_0bc.imp" />
<!-- This document is ok. -->
<xsd:import namespace="http://BAR" schemaLocation="import1_0.imp" />
<!-- This document will be skipped, since a schema for the namespace
"http://BAR" was already imported. -->
<xsd:import namespace="http://BAR" schemaLocation="import1_0b.imp" />
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="bar"/>
<xsd:element ref="bar:bar.A"/>
<xsd:element ref="bar:bar.B"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://BAR">
<xsd:element name="bar.B"/>
</xsd:schema>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO"
xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
elementFormDefault="qualified">
<!-- We need to import the namespace for the schema to be valid. -->
<xsd:import namespace="http://BAR"/>
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="foo.B" type="bar:fooType"/>
<xsd:element ref="bar:bar"/>
</xsd:sequence>
<xsd:attribute name="foo.attr"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo:foo xmlns:foo="http://FOO"
xmlns:bar="http://BAR"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://BAR import2_0.xsd" foo.attr="oo">
<foo:foo.B/>
<bar:bar/>
</foo:foo>

View File

@ -0,0 +1,24 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:foo="http://FOO"
targetNamespace="http://BAR"
elementFormDefault="qualified">
<xsd:import namespace="http://FOO" schemaLocation="import2_0.imp"/>
<xsd:simpleType name="fooType">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="bar">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="foo:foo" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="qualified"
blockDefault="extension" finalDefault="extension">
<xsd:element name="bar">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="bar.B" type="xsd:anyType"/>
</xsd:sequence>
<xsd:attribute name="bar"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<foo:foo
xmlns:foo="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO include2_0.xsd">
<foo:bar foo:bar="ooo">
<foo:bar.B foo:bar="ooo"/>
</foo:bar>
</foo:foo>

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO"
xmlns:foo="http://FOO">
<xsd:include schemaLocation="include2_0.inc" />
<xsd:element name="foo">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="foo:bar"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="bar" />
</xsd:schema>

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<foo:foo
xmlns:foo="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO include3_0.xsd">
<foo:bar />
</foo:foo>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://FOO"
xmlns:foo="http://FOO">
<xsd:include schemaLocation="include3_0.inc" />
<xsd:element name="bar"/>
<xsd:element name="foo"/>
</xsd:schema>

View File

@ -0,0 +1,3 @@
<?xml version="1.0"?>
<foo xmlns="http://FOO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO file:///l:/libxml2/test/schemas/restriction-attr1_0.xsd" barA="hh"/>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://FOO" targetNamespace="http://FOO">
<xs:element name="foo">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="typeA">
<xs:attribute name="barA" type="xs:string" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="typeA">
<xs:attribute name="barA" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<foo:foo xmlns:foo="http://FOO"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://FOO seq-dubl-elem1_0.xsd">
<foo:PGPKeyID>PEhlbGxvIHdvcmxkIT4=</foo:PGPKeyID>
<foo:PGPKeyPacket>PEhlbGxvIHdvcmxkIT4=</foo:PGPKeyPacket>
</foo:foo>

View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:foo="http://FOO"
targetNamespace="http://FOO" version="0.1"
elementFormDefault="qualified">
<complexType name="fooType">
<choice>
<sequence>
<element name="PGPKeyID" type="base64Binary"/>
<element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
<any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
<sequence>
<element name="PGPKeyPacket" type="base64Binary"/>
<any namespace="##other" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</choice>
</complexType>
<element name="foo" type="foo:fooType"/>
</schema>

117
test/schemas/xml.xsd Normal file
View File

@ -0,0 +1,117 @@
<?xml version='1.0' encoding="ISO-8859-1"?>
<!--!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" -->
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">
<xs:annotation>
<xs:documentation>
See http://www.w3.org/XML/1998/namespace.html and
http://www.w3.org/TR/REC-xml for information about this namespace.
This schema document describes the XML namespace, in a form
suitable for import by other schema documents.
Note that local names in this namespace are intended to be defined
only by the World Wide Web Consortium or its subgroups. The
following names are currently defined in this namespace and should
not be used with conflicting semantics by any Working Group,
specification, or document instance:
base (as an attribute name): denotes an attribute whose value
provides a URI to be used as the base for interpreting any
relative URIs in the scope of the element on which it
appears; its value is inherited. This name is reserved
by virtue of its definition in the XML Base specification.
lang (as an attribute name): denotes an attribute whose value
is a language code for the natural language of the content of
any element; its value is inherited. This name is reserved
by virtue of its definition in the XML specification.
space (as an attribute name): denotes an attribute whose
value is a keyword indicating what whitespace processing
discipline is intended for the content of the element; its
value is inherited. This name is reserved by virtue of its
definition in the XML specification.
Father (in any context at all): denotes Jon Bosak, the chair of
the original XML Working Group. This name is reserved by
the following decision of the W3C XML Plenary and
XML Coordination groups:
In appreciation for his vision, leadership and dedication
the W3C XML Plenary on this 10th day of February, 2000
reserves for Jon Bosak in perpetuity the XML name
xml:Father
</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>This schema defines attributes and an attribute group
suitable for use by
schemas wishing to allow xml:base, xml:lang or xml:space attributes
on elements they define.
To enable this, such a schema must import this schema
for the XML namespace, e.g. as follows:
&lt;schema . . .>
. . .
&lt;import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
Subsequently, qualified reference to any of the attributes
or the group defined below will have the desired effect, e.g.
&lt;type . . .>
. . .
&lt;attributeGroup ref="xml:specialAttrs"/>
will define a type which will schema-validate an instance
element with any of those attributes</xs:documentation>
</xs:annotation>
<xs:annotation>
<xs:documentation>In keeping with the XML Schema WG's standard versioning
policy, this schema document will persist at
http://www.w3.org/2001/03/xml.xsd.
At the date of issue it can also be found at
http://www.w3.org/2001/xml.xsd.
The schema document at that URI may however change in the future,
in order to remain compatible with the latest version of XML Schema
itself. In other words, if the XML Schema namespace changes, the version
of this document at
http://www.w3.org/2001/xml.xsd will change
accordingly; the version at
http://www.w3.org/2001/03/xml.xsd will not change.
</xs:documentation>
</xs:annotation>
<xs:attribute name="lang" type="xs:language">
<xs:annotation>
<xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter
codes as the enumerated possible values . . .</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="space" default="preserve">
<xs:simpleType>
<xs:restriction base="xs:NCName">
<xs:enumeration value="default"/>
<xs:enumeration value="preserve"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="base" type="xs:anyURI">
<xs:annotation>
<xs:documentation>See http://www.w3.org/TR/xmlbase/ for
information about this attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup name="specialAttrs">
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:lang"/>
<xs:attribute ref="xml:space"/>
</xs:attributeGroup>
</xs:schema>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- This is the test data for the check of the implementation of the "itemType" attribute of the xsd:list element. -->
<foo xmlns="http://FOO">tea for two and two for tea</foo>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- This test checks the implementation of the "itemType" attribute of the xsd:list element. -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://FOO" xmlns:foo="http://FOO">
<element name="foo">
<simpleType>
<list itemType="string"/>
</simpleType>
</element>
</schema>

File diff suppressed because it is too large Load Diff

View File

@ -226,7 +226,8 @@ xmlSchemaInitBasicType(const char *name, xmlSchemaValType type,
(type == XML_SCHEMAS_NMTOKENS) ||
(type == XML_SCHEMAS_ENTITIES))
ret->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
else if (type != XML_SCHEMAS_UNKNOWN)
else if ((type != XML_SCHEMAS_ANYTYPE) &&
(type != XML_SCHEMAS_ANYSIMPLETYPE))
ret->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
ret->contentType = XML_SCHEMA_CONTENT_BASIC;
switch (type) {
@ -277,7 +278,7 @@ xmlSchemaInitTypes(void)
* 3.4.7 Built-in Complex Type Definition
*/
xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",
XML_SCHEMAS_UNKNOWN,
XML_SCHEMAS_ANYTYPE,
NULL);
xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;
xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
@ -286,7 +287,7 @@ xmlSchemaInitTypes(void)
wild = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard));
if (wild == NULL) {
xmlSchemaTypeErrMemory(NULL, "could not create a wildcard on anyType");
xmlSchemaTypeErrMemory(NULL, "could not create an attribute wildcard on anyType");
return;
}
memset(wild, 0, sizeof(xmlSchemaWildcard));
@ -297,7 +298,7 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeAnyTypeDef->attributeWildcard = wild;
}
xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",
XML_SCHEMAS_UNKNOWN,
XML_SCHEMAS_ANYSIMPLETYPE,
xmlSchemaTypeAnyTypeDef);
/*
* primitive datatypes
@ -1745,10 +1746,10 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
switch (type->builtInType) {
case XML_SCHEMAS_UNKNOWN:
if ((type == xmlSchemaTypeAnySimpleTypeDef) ||
(type == xmlSchemaTypeAnyTypeDef))
goto return0;
goto error;
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
goto return0;
case XML_SCHEMAS_STRING:
goto return0;
case XML_SCHEMAS_NORMSTRING:{
@ -3548,6 +3549,8 @@ xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) {
switch (x->type) {
case XML_SCHEMAS_UNKNOWN:
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
return(-2);
case XML_SCHEMAS_INTEGER:
case XML_SCHEMAS_NPINTEGER:
@ -3688,9 +3691,6 @@ xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) {
case XML_SCHEMAS_NMTOKENS:
TODO
break;
case XML_SCHEMAS_ANYTYPE:
case XML_SCHEMAS_ANYSIMPLETYPE:
break;
}
return -2;
}