Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: XML Schema problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XML Schema problem



Yes. The schema file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://some.org/metamodel";
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
  <xs:element name="system">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="vendor" type="xs:string"/>
        <xs:element name="version" type="xs:decimal"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

and is identical for both, the "file test" and the JDOM test. Please
note, that it is working on Windows and also in the XOM test on the
Mac, but not on JDOM or dom4j on the Mac. That's why it is really
strange.

On Thu, Mar 26, 2009 at 1:38 AM, Alexei Svitkine
<email@hidden> wrote:
> Is the schema declared as:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>
> On Wed, Mar 25, 2009 at 5:36 PM, Moritz Petersen <email@hidden> wrote:
>> Hello everyone,
>> I've run into a strange problem. In my project I experimented a bit with XML
>> Schema validation. I use 4 approaches to generate XML and XML Schema
>> documents: Files (both documents exist as actual XML files), JDOM (both
>> documents get generated with JDOM), dom4j and XOM.
>> Why am I posting to this list? I started development on a Windows machine.
>> All my tests run smoothly on that machine. When installing the same project
>> on my old Mac (PowerBook G4, Mac OS X 10.5.6, java version "1.5.0_16"), both
>> tests for JDOM and dom4j fail with the same error:
>> org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute
>> value for 'type' in element 'element'. Recorded reason: UndeclaredPrefix:
>> Cannot resolve 'xs:decimal' as a QName: the prefix 'xs' is not declared.
>> The test code is the same for each test:
>>     protected void assertXsdValid(Source xsdSource, InputSource
>> xmlInputSource) throws SAXException, ParserConfigurationException,
>> IOException {
>>         isValid = true;
>>         SchemaFactory sf =
>> SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
>>         sf.setErrorHandler(myErrorHandler);
>>         Schema schema = sf.newSchema(xsdSource); // <<--- Here it fails!!
>>         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
>>         dbf.setNamespaceAware(true);
>>         dbf.setSchema(schema);
>>         DocumentBuilder db = dbf.newDocumentBuilder();
>>         db.setErrorHandler(myErrorHandler);
>>         db.parse(xmlInputSource); // sets the isValid field to false if
>> validation fails
>>         assertTrue(isValid);
>>     }
>> The strange thing is, that if I copy the JDOM generated XSD file into the
>> XSD file of the "file test" (see above), then the "file test" does not fail.
>> I can't help but guessing that this might be some Mac related issue, but I
>> cannot figure out what it might be. Maybe someone in this list can help me
>> out.
>> Thank you.
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Java-dev mailing list      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >XML Schema problem (From: Moritz Petersen <email@hidden>)
 >Re: XML Schema problem (From: Alexei Svitkine <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.