Yup that would work but my preference would be to use the parser options as
specified. Anyone know if the one described in my original email works.
-----Original Message-----
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
Sent: Thursday, August 30, 2001 12:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Parser locating of schema documents
I subclass of�org.apache.xerces.parsers.SAXParser and in that class I add a method
This works.
e.g
public class newParser extends org.apache.xerces.parsers.SAXParser
{
�������/*
���������stValue="" <http://www.ncube.com/2001/nable/1.7> /usr/ncube/etc/schema/CMS-DataStructure.xsd� <http://www.ncube.com/2001/nable/1.7> /usr/ncube/etc/schema/TypeLibrary-cms.xsd"
*/
��� public void setSchemas(String stValue)
��� {
������� setExternalSchemaLocation(stValue);
��� }
}
�
-----Original Message-----
From: Chris Halverson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 12:29 PM
To: [EMAIL PROTECTED]
Subject: Parser locating of schema documents
Thanks Neil, that did it. Now I have another question in line with John Powell's most recent send.
I've tried setting the external-schemaLocation property on the parser to abstract my schema and
instance documents from needing to know the exact location of schema files as below.
parser.setProperty(" <http://apache.org/xml/properties/schema/external-schemaLocation>",
" <http://www.ncube.com/2001/nable/1.7> /usr/ncube/etc/schema/CMS-DataStructure.xsd
<http://www.ncube.com/2001/nable/1.7> /usr/ncube/etc/schema/TypeLibrary-cms.xsd");
That doesn't work but perhaps I'm doing it wrong.� The basic syntax conforms with schemaLocation
as paired namespace reference values but if I'm not pointing to a Web URL should I use a file URL?
Anyone using this feature.� Any help would be appreciated.
C
Christopher R. Halverson
nCube
[EMAIL PROTECTED]
"Never underestimate the ability of any human to delude themselves,"
"and convince others their delusion is absolute"
-----Original Message-----
From:�� [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]
Sent:�� Thursday, August 30, 2001 9:05 AM
To:���� [EMAIL PROTECTED]
Subject:������� Re: Validation and schema hierarchies
Hi Chris,
I notice that your root schema has elementFormDefault="qualified" and your
included schema has elementFormDefault="unqualified".� Thus the local
elements in the included schema are in the null namespace, but your
instance document has the default namespace bound to a non-null namespace.
This is probably the source of your problem.
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:� 416-448-3519, T/L 778-3519
E-mail:� [EMAIL PROTECTED]
Chris Halverson <[EMAIL PROTECTED]> on 08/30/2001 09:59:26 AM
Please respond to [EMAIL PROTECTED]
To:�� [EMAIL PROTECTED]
cc:
Subject:� Validation and schema hierarchies
I'm getting these errors, I think its a namespace thing but I'm not sure.
I would appreciate any help
in the offing.
[Error] :8:33: Element type "version" must be declared.
[Error] :8:33: Attribute "major" must be declared for element type
"version".
[Error] :8:33: Attribute "minor" must be declared for element type
"version".
[Error] :9:42: Element type "property" must be declared.
[Error] :9:42: Attribute "key" must be declared for element type
"property".
[Error] :9:42: Attribute "value" must be declared for element type
"property".
With this instance document
<?xml version="1.0" encoding="UTF-8"?>
<XMLDataSet xmlns=" <http://www.ncube.com/2001/nable/1.7>"
������� xmlns:xsi=" <http://www.w3.org/2001/XMLSchema-instance>"
������� xsi:schemaLocation=" <http://www.ncube.com/2001/nable/1.7>
CMS-DataStructure.xsd"
������� elementId="n_999" name="Test Set" authenticationString="authstring
">
������� <Category elementId="n_1000" name="Action" dvbCode="String" rating
="String" isAdult="1" channelIdent="String">
��������������� <version major="2" minor="2"/>
��������������� <property key="String" value="String"/>
��������������� <property key="String" value="String"/>
��������������� <note>String</note>
��������������� <note>String</note>
��������������� <CategoryRef>String</CategoryRef>
��������������� <FileRef>String</FileRef>
��������������� <FileRef>String</FileRef>
��������������� <CategoryName elementId="n_1001" language="String" name="
String">
����������������������� <property key="String" value="String"/>
����������������������� <property key="String" value="String"/>
��������������� </CategoryName>
��������������� <CategoryName elementId="n_1002" language="String" name="
String">
����������������������� <property key="String" value="String"/>
����������������������� <property key="String" value="String"/>
��������������� </CategoryName>
������� </Category>
With this extended schema definition in CMS-DataStructure.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema
������� targetNamespace=" <http://www.ncube.com/2001/nable/1.7>"
������� xmlns:nxs=" <http://www.ncube.com/2001/nable/1.7>"
������� xmlns=" <http://www.w3.org/2001/XMLSchema>"
������� elementFormDefault="qualified" attributeFormDefault="unqualified">
������� <annotation>
��������������� <documentation xml:lang="en">
�Metadata schema base types for nCUBE Corporation nABLE Metadata API.
�Copyright 2001 nCUBE Corp. All rights reserved.
�</documentation>
������� </annotation>
������� <include schemaLocation="TypeLibrary-cms.xsd"/>
������� <element name="Category">
��������������� <complexType>
����������������������� <complexContent>
������������������������������� <extension base="nxs:Category">
��������������������������������������� <sequence>
����������������������������������������������� <element name="CategoryRef"
type="nxs:CategoryRef" minOccurs="0"/>
����������������������������������������������� <element name="FileRef"
type="nxs:FileRef" minOccurs="0" maxOccurs="unbounded"/>
����������������������������������������������� <element name="CategoryName
" type="nxs:CategoryName" maxOccurs="unbounded"/>
��������������������������������������� </sequence>
������������������������������� </extension>
����������������������� </complexContent>
��������������� </complexType>
������� </element>
</schema>
Based on this underlying schema definition in TypeLibrary-cms.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema
������� targetNamespace=" <http://www.ncube.com/2001/nable/1.7>"
������� xmlns:nxs=" <http://www.ncube.com/2001/nable/1.7>"
������� xmlns=" <http://www.w3.org/2001/XMLSchema>"
������� elementFormDefault="unqualified" attributeFormDefault="unqualified
">
������� <complexType name="Version">
��������������� <attribute name="major" type="positiveInteger" use="
required"/>
��������������� <attribute name="minor" type="positiveInteger" use="
required"/>
������� </complexType>
������� <complexType name="Property">
��������������� <attribute name="key" type="string" use="required"/>
��������������� <attribute name="value" type="string" use="required"/>
������� </complexType>
������� <complexType name="Category">
��������������� <sequence>
����������������������� <element name="version" type="nxs:Version"/>
����������������������� <element name="property" type="nxs:Property"
minOccurs="0" maxOccurs="unbounded"/>
����������������������� <element name="note" type="nxs:Note" minOccurs="0"
maxOccurs="unbounded"/>
��������������� </sequence>
��������������� <attribute name="elementId" type="ID" use="required"/>
��������������� <attribute name="name" type="string" use="required"/>
��������������� <attribute name="dvbCode" type="string" use="required"/>
��������������� <attribute name="rating" type="string" use="required"/>
��������������� <attribute name="isAdult" type="boolean" use="required"/>
��������������� <attribute name="channelIdent" type="string"/>
������� </complexType>
</schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
