diff --git a/src/xercesc/validators/schema/SchemaElementDecl.hpp b/src/xercesc/validators/schema/SchemaElementDecl.hpp index c66f68fd712dc6a76d11ccd6c5967178075571b3..485fca112b83ae0e292ed86fd894ba7f032afe89 100644 --- a/src/xercesc/validators/schema/SchemaElementDecl.hpp +++ b/src/xercesc/validators/schema/SchemaElementDecl.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.12 2003/08/29 11:44:18 gareth + * If a type was explicitly declared as anyType that now gets set in DOMTypeInfo. Added test cases. + * * Revision 1.11 2003/05/18 14:02:08 knoaman * Memory manager implementation: pass per instance manager. * @@ -616,12 +619,8 @@ inline const XMLCh* SchemaElementDecl::getTypeName() const { else if(fDatatypeValidator) return fDatatypeValidator->getTypeLocalName(); - //its anyType if we have not done validation on it - if(getValidationAttempted() == PSVIDefs::NONE) - return SchemaSymbols::fgATTVAL_ANYTYPE; - - - return 0; + //its anyType if we have not done validation on it or none of the above exist + return SchemaSymbols::fgATTVAL_ANYTYPE; } inline PSVIDefs::Complexity SchemaElementDecl::getTypeType() const { @@ -644,12 +643,8 @@ inline const XMLCh* SchemaElementDecl::getTypeUri() const { else if(fDatatypeValidator) return fDatatypeValidator->getTypeUri(); - //its anyType if we have not done validation on it - if(getValidationAttempted() == PSVIDefs::NONE) - return SchemaSymbols::fgURI_SCHEMAFORSCHEMA; - - - return 0; + //its anyType if we have not done validation on it or none of the above exist + return SchemaSymbols::fgURI_SCHEMAFORSCHEMA; } inline const XMLCh* SchemaElementDecl::getMemberTypeName() const { @@ -718,7 +713,7 @@ inline bool SchemaElementDecl::getTypeAnonymous() const { return fDatatypeValidator->getAnonymous(); } - return true; + return false; } inline const XMLCh* SchemaElementDecl::getDOMTypeInfoName() const { diff --git a/tests/DOM/TypeInfo/TypeInfo.cpp b/tests/DOM/TypeInfo/TypeInfo.cpp index 9195a1b2a477f172ff93054827264c4414a60bb3..e1ff45fa2e38dbdf0d6055bd08c23e74731f5464 100644 --- a/tests/DOM/TypeInfo/TypeInfo.cpp +++ b/tests/DOM/TypeInfo/TypeInfo.cpp @@ -192,6 +192,9 @@ bool TypeInfo::testInBuiltTypesOnAttributes(bool DTDPresent) { DOMAttr *testAttr; + testAttr = testEle->getAttributeNodeNS(0, X("anySimpleType")); + DOMTYPEINFOTEST(testAttr->getTypeInfo(), SchemaSymbols::fgDT_ANYSIMPLETYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, __LINE__); + testAttr = testEle->getAttributeNodeNS(0, X("string")); DOMTYPEINFOTEST(testAttr->getTypeInfo(), SchemaSymbols::fgDT_STRING, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, __LINE__); @@ -464,6 +467,9 @@ bool TypeInfo::testInBuiltTypesOnElements() { testEle = (DOMElement *)testEle->getNextSibling()->getNextSibling(); DOMTYPEINFOTEST(testEle->getTypeInfo(), SchemaSymbols::fgDT_POSITIVEINTEGER, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, __LINE__); + testEle = (DOMElement *)testEle->getNextSibling()->getNextSibling(); + DOMTYPEINFOTEST(testEle->getTypeInfo(), SchemaSymbols::fgATTVAL_ANYTYPE, SchemaSymbols::fgURI_SCHEMAFORSCHEMA, __LINE__); + return passed; } diff --git a/tests/DOM/TypeInfo/data/TypeInfo.xml b/tests/DOM/TypeInfo/data/TypeInfo.xml index adda1bb4d34ff2d0361424b952e06e0b02138c62..80c60048cf2983c0a8a3978a01b14ea4d2f6ade3 100644 --- a/tests/DOM/TypeInfo/data/TypeInfo.xml +++ b/tests/DOM/TypeInfo/data/TypeInfo.xml @@ -1,6 +1,7 @@ <!DOCTYPE root SYSTEM "TypeInfo.dtd" > <root xsi:noNamespaceSchemaLocation="TypeInfo.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ss="http://www.secondSchema" > <attrTest +anySimpleType="asdas" string="string" boolean="true" decimal="2.0" @@ -87,6 +88,7 @@ xsi:noNamespaceSchemaLocation="hello" <level1unsignedShort >1</level1unsignedShort> <level1unsignedByte >1</level1unsignedByte> <level1positiveInteger >1</level1positiveInteger> + <level1anyType /> </eleTest> <simpleDerTest decimalDerived="50" stringDerived="hello" > <decimalDerived >20</decimalDerived> diff --git a/tests/DOM/TypeInfo/data/TypeInfo.xsd b/tests/DOM/TypeInfo/data/TypeInfo.xsd index 9d2ea39463ee5f8a867213670dcda422bcf6c159..dde31d4d1c6e2508ccefbd44bd7d18333bb9e95d 100644 --- a/tests/DOM/TypeInfo/data/TypeInfo.xsd +++ b/tests/DOM/TypeInfo/data/TypeInfo.xsd @@ -213,10 +213,12 @@ <xs:element name="level1unsignedShort" type="xs:unsignedShort" /> <xs:element name="level1unsignedByte" type="xs:unsignedByte" /> <xs:element name="level1positiveInteger" type="xs:positiveInteger" /> + <xs:element name="level1anyType" type="xs:anyType" /> </xs:sequence> </xs:complexType> <xs:complexType name="attrTestType" > + <xs:attribute name="anySimpleType" type="xs:anySimpleType" /> <xs:attribute name="string" type="xs:string" /> <xs:attribute name="boolean" type="xs:boolean" /> <xs:attribute name="decimal" type="xs:decimal" /> diff --git a/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xml b/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xml index 61055c59a03fa1c20cbd9376a898e45109d379fd..1a6d4af481c3266e376a87cd9c4231b20dfc8341 100644 --- a/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xml +++ b/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xml @@ -1,5 +1,6 @@ <root xsi:noNamespaceSchemaLocation="TypeInfoNoDTD.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ss="http://www.secondSchema" > <attrTest +anySimpleType="asdas" string="string" boolean="true" decimal="2.0" @@ -84,6 +85,7 @@ xsi:noNamespaceSchemaLocation="hello" <level1unsignedShort >1</level1unsignedShort> <level1unsignedByte >1</level1unsignedByte> <level1positiveInteger >1</level1positiveInteger> + <level1anyType /> </eleTest> <simpleDerTest decimalDerived="50" stringDerived="hello" > <decimalDerived >20</decimalDerived> diff --git a/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xsd b/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xsd index b1e4fc092864b6cb036edceedb10684ff8c88fec..b199fb66fdf980ab23dea358233936729a983549 100644 --- a/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xsd +++ b/tests/DOM/TypeInfo/data/TypeInfoNoDTD.xsd @@ -213,10 +213,12 @@ <xs:element name="level1unsignedShort" type="xs:unsignedShort" /> <xs:element name="level1unsignedByte" type="xs:unsignedByte" /> <xs:element name="level1positiveInteger" type="xs:positiveInteger" /> + <xs:element name="level1anyType" type="xs:anyType" /> </xs:sequence> </xs:complexType> <xs:complexType name="attrTestType" > + <xs:attribute name="anySimpleType" type="xs:anySimpleType" /> <xs:attribute name="string" type="xs:string" /> <xs:attribute name="boolean" type="xs:boolean" /> <xs:attribute name="decimal" type="xs:decimal" />