Am I using xs:anyType correctly?
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 71
- Joined: Fri Apr 30, 2004 8:00 pm
- Location: Texas
Am I using xs:anyType correctly?
I am trying to use a published Schema for a XRPC interface. The problem is I can't even validate the example XML they provide with their own schema. Either their schema has a flaw, or the schema validator used by Oxygen7.1 isn't working.
I lean toward the first so I did a simple example that contains the problem
Here's the XML file
What I need is a schema that just address the 'mph1' namespace and ignores all others ('mph2' in this example)
First, this schema works. It does what I expect xs:anyType to do.. Ignore the NewFirst element and all that it contains.
Now, this is a modification to that working schema that reflects the published schema. It's supposed to do the same thing, but using the constructs as used by the published schema.
The main difference is rather than an inline type, I use a complexType that resolved to xs:anyType. It should be the same as the first, right?
It's not. I get an error:
Looks right to me.. the content of the second element should still resolve to xs:anyType.
Who's broken? The publiushed schema or the xsd validator?
I lean toward the first so I did a simple example that contains the problem
Here's the XML file
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:mph1 ../XSD/xsd-test-02.xsd" xmlns="urn:mph1">
<first>
<second>
<NewFirst xmlns="urn:mph2">
<NewSecond/>
</NewFirst>
</second>
</first>
</root>
First, this schema works. It does what I expect xs:anyType to do.. Ignore the NewFirst element and all that it contains.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="urn:mph1" xmlns:mph1="urn:mph1">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="mph1:first"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="first">
<xs:complexType>
<xs:sequence>
<xs:element ref="mph1:second"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="second" type="xs:anyType"/>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="urn:mph1" xmlns:mph1="urn:mph1">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element ref="mph1:first"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="first">
<xs:complexType>
<xs:sequence>
<xs:element ref="mph1:second"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="second" type="mph1:secondType"/>
<xs:complexType name="secondType">
<xs:complexContent>
<xs:restriction base="xs:anyType"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>
It's not. I get an error:
Code: Select all
SystemID: D:\mphare\Development\FW6500\XML\SchemaTest\xsd-test-01.xml
Location: 9:18
Description: cvc-complex-type.2.1: Element 'second' must have no character or element information item [children], because the type's content type is empty.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
Who's broken? The publiushed schema or the xsd validator?
--------------------------
- mike
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876
- mike
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
The content type for the secondType is empty, thus it cannot have any content, neither elements nor character data. To see how the content type is computed see
http://www.w3.org/TR/xmlschema-1/#key-efm
The default schema validator used by oXygen is Xerces J 2.8.0. You can however validate from oXygen also with other engines like XSV, LIBXML, MSXML 4.0, MSXML .NET and Saxon SA. For details about configuring them see the custom validation section from the user guide:
http://www.oxygenxml.com/doc/ug-oxygen/ ... validation
All of these validators above report the error on your example.
Best Regards,
George
The content type for the secondType is empty, thus it cannot have any content, neither elements nor character data. To see how the content type is computed see
http://www.w3.org/TR/xmlschema-1/#key-efm
The default schema validator used by oXygen is Xerces J 2.8.0. You can however validate from oXygen also with other engines like XSV, LIBXML, MSXML 4.0, MSXML .NET and Saxon SA. For details about configuring them see the custom validation section from the user guide:
http://www.oxygenxml.com/doc/ug-oxygen/ ... validation
All of these validators above report the error on your example.
Best Regards,
George
-
- Posts: 71
- Joined: Fri Apr 30, 2004 8:00 pm
- Location: Texas
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