xs:anyAttribute validation problems
Oxygen general issues.
-
- Posts: 2
- Joined: Thu Jun 15, 2006 11:05 pm
xs:anyAttribute validation problems
I am having an issue with Oxygen validating documents against a schema with an anyAttribute in it.
I have a XML schema that I want to have a XML element that can have an element that can take any arbitrary attribute. So I have the following in my schema:
<xs:element name="properties">
<xs:complexType>
<!--xs:attribute name="code" type="xs:string"/-->
<!--xs:attribute name="enabled" type="xs:int"/-->
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
</xs:element>
I validate a document which contains the following XML:
<element name="army01">
...
<properties code="army" enabled="1"/>
...
</element>
andI get the following validation error:
SystemID: /home/fahome/cmihaly/xml/test.xml
Location: 7:42
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'properties'. One of '{"http://spca.fa.disney.com/sceneDescr_20060608":ref, "http://spca.fa.disney.com/sceneDescr_20060608":geoms, "http://spca.fa.disney.com/sceneDescr_20060608":anims}' is expected.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I am not sure why I am getting this valiation error? I believe the anyAttribute is supposed to allow me to place arbitrary attributes on my properties definition. I actuallya dded the processContents="skip" which rediced the # of errors I was getting, but still did not get rid of the above.
Any help would be appreciated! By the way, XMLSpy does validate the schema, not saying that means it is right, but at least a different point of view
Thanks
Chris
I have a XML schema that I want to have a XML element that can have an element that can take any arbitrary attribute. So I have the following in my schema:
<xs:element name="properties">
<xs:complexType>
<!--xs:attribute name="code" type="xs:string"/-->
<!--xs:attribute name="enabled" type="xs:int"/-->
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
</xs:element>
I validate a document which contains the following XML:
<element name="army01">
...
<properties code="army" enabled="1"/>
...
</element>
andI get the following validation error:
SystemID: /home/fahome/cmihaly/xml/test.xml
Location: 7:42
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'properties'. One of '{"http://spca.fa.disney.com/sceneDescr_20060608":ref, "http://spca.fa.disney.com/sceneDescr_20060608":geoms, "http://spca.fa.disney.com/sceneDescr_20060608":anims}' is expected.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I am not sure why I am getting this valiation error? I believe the anyAttribute is supposed to allow me to place arbitrary attributes on my properties definition. I actuallya dded the processContents="skip" which rediced the # of errors I was getting, but still did not get rid of the above.
Any help would be appreciated! By the way, XMLSpy does validate the schema, not saying that means it is right, but at least a different point of view

Thanks
Chris
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: xs:anyAttribute validation problems
Post by sorin_ristache »
Hello Chris,
Regards,
Sorin
The error message says that the content of the parent of the "properties" element is not valid. The error does not have any connection with the content of the "properties" element. To receive more help please post the content of the element which contains "properties" and also the content model of the parent of "properties" as declared in the XML Schema.cmihaly wrote:I get the following validation error:
SystemID: /home/fahome/cmihaly/xml/test.xml
Location: 7:42
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'properties'. One of '{"http://spca.fa.disney.com/sceneDescr_20060608":ref, "http://spca.fa.disney.com/sceneDescr_20060608":geoms, "http://spca.fa.disney.com/sceneDescr_20060608":anims}' is expected.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I am not sure why I am getting this valiation error?
Regards,
Sorin
-
- Posts: 2
- Joined: Thu Jun 15, 2006 11:05 pm
Ok, I cut down my example. I included the schema and a sample that does not validate. If on the test.xml, I remove the <ref line> then it does validate. But it appears to me that it should be correct with both. Or maybe I am just violating a xml rule I do not understand.
Thanks
Chris
The following is sceneDescrSchema_v0020.xsd
-------------------------------- Schema ----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Jon Wada (private) -->
<xs:schema targetNamespace="http://spca.fa.disney.com/sceneDescr_20060608" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://spca.fa.disney.com/sceneDescr_20060608" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="config" type="ConfigType">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="ConfigType">
<xs:complexContent>
<xs:extension base="MetadataItem">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Item">
<xs:sequence minOccurs="0">
<xs:element ref="properties"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MetadataItem">
<xs:complexContent>
<xs:extension base="Item">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ref"/>
</xs:sequence>
<xs:attribute name="context" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="properties">
<xs:complexType>
<!--xs:attribute name="code" type="xs:string"/-->
<!--xs:attribute name="enabled" type="xs:int"/-->
<xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:complexType name="RefType">
<xs:annotation>
<xs:documentation>A reference to another sceneDescr config</xs:documentation>
</xs:annotation>
<xs:attribute name="path" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="ref" type="RefType"/>
</xs:schema>
Sample file to validate:
<?xml version="1.0" ?>
<config xmlns="http://spca.fa.disney.com/sceneDescr_20060608"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://spca.fa.disney.com/sceneDescr_20060608 file:/home/fahome/cmihaly/xml/sceneDescrSchema_v0020.xsd">
<ref path="/jobs2/ADOG/sa/shared/elements/army_descr.xml"/>
<properties code="army" enabled="1"/>
</config>
Thanks
Chris
The following is sceneDescrSchema_v0020.xsd
-------------------------------- Schema ----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Jon Wada (private) -->
<xs:schema targetNamespace="http://spca.fa.disney.com/sceneDescr_20060608" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://spca.fa.disney.com/sceneDescr_20060608" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="config" type="ConfigType">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="ConfigType">
<xs:complexContent>
<xs:extension base="MetadataItem">
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Item">
<xs:sequence minOccurs="0">
<xs:element ref="properties"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MetadataItem">
<xs:complexContent>
<xs:extension base="Item">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="ref"/>
</xs:sequence>
<xs:attribute name="context" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="properties">
<xs:complexType>
<!--xs:attribute name="code" type="xs:string"/-->
<!--xs:attribute name="enabled" type="xs:int"/-->
<xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:complexType name="RefType">
<xs:annotation>
<xs:documentation>A reference to another sceneDescr config</xs:documentation>
</xs:annotation>
<xs:attribute name="path" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="ref" type="RefType"/>
</xs:schema>
Sample file to validate:
<?xml version="1.0" ?>
<config xmlns="http://spca.fa.disney.com/sceneDescr_20060608"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://spca.fa.disney.com/sceneDescr_20060608 file:/home/fahome/cmihaly/xml/sceneDescrSchema_v0020.xsd">
<ref path="/jobs2/ADOG/sa/shared/elements/army_descr.xml"/>
<properties code="army" enabled="1"/>
</config>
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
If you open the schema and look to the logical model view, and expand the config element then you can see its model and see that it should contain optionally a properties element followed by zero or more ref elements. So you should have properties before ref, in your example you have properties after ref and that is clearly no allowed.
Best Regards,
George
If you open the schema and look to the logical model view, and expand the config element then you can see its model and see that it should contain optionally a properties element followed by zero or more ref elements. So you should have properties before ref, in your example you have properties after ref and that is clearly no allowed.
Best Regards,
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service