Perhaps it is the XML validation tool I am using that is causing the issues 
(XMLStarlet version 1.0.1), but it will not parse an XSD that uses xs:element 
with the ref= attribute for named complex types. It will only parse properly if 
the ref= attribute points to a global element declaration in the external 
namespace. The tool will however allow me to extend a named complex type from 
an external namespace, so I know that the xs:import is working.

Attached are two example XSDs and instance XML documents, both importing the 
LTK-XML namespace. Example1 shows that the LLRPStatus element may be extended, 
but Example2 shows that the LLRPStatus element may not be referenced within 
xs:element.

$ xml --version
1.0.1
$ xml val -e --xsd example1.xsd example1.xml
example1.xml - valid
$ xml val -e --xsd example2.xsd example2.xml
example2.xsd:18: element element: Schemas parser error : Element 
'{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value 
'{http://www.llrp.org/ltk/schema/core/encoding/xml/1.0}LLRPStatus' does not 
resolve to a(n) element declaration.
$

I did verify that adding a global xs:element declaration of LLRPStatus within 
llrp.xsd does allow example2.xml to validate against example2.xsd, which lead 
to the desire to promote all LLRP parameter types to global elements within 
LTK-XML. Does anyone have a XML validation tool that allows example2.xml to 
validate with only the named complex type definition in llrp.xsd?

Thanks,

C

-----Original Message-----
From: John R. Hogerhuis [mailto:[email protected]] 
Sent: Wednesday, June 03, 2009 11:37 AM
To: LLRP Toolkit Development List
Subject: Re: [ltk-d] Recommended change to llrp-1x0.xsd

On Wed, Jun 3, 2009 at 11:22 AM, Paul Dietrich <[email protected]> wrote:
> Thanks John,
>
> I understand the side effects, but thought that the behavior you describe 
> below is desirable rather than detrimental.  For example, there are cases 
> where a user would want to import a single LLRP parameter from LTK-XML into 
> internal objects (e.g. .NET).  It would not be possible to validate this 
> parameter against the schema unless the parameters appear as root of the 
> schema.
>

Typically, XML documents are validatable but fragments are not, since
fragments are not XML AFAIK.

> I'm OK with deferring this decision until a later time, but I'm curious what 
> alternatives you were thinking about to address the issue of LLRP parameters 
> within custom messages.
>

I don't use XML Schema every day, so my first thought was for me to
re-read the XML Schema specification and try to find a good answer :-)

It looks like the link Christian just provided may be helpful in that regard.

-- John.

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
llrp-toolkit-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/llrp-toolkit-devel

<?xml version="1.0" encoding="utf-8"?>

<example:LLRP_CUSTOM_MESSAGE MessageID="1001"
  xmlns:example="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
  xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
  xmlns="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";>
  <example:LLRPExtStatus>
    <StatusCode>M_Success</StatusCode>
    <ErrorDescription></ErrorDescription>
    <example:ErrorRemedy>Reboot</example:ErrorRemedy>
  </example:LLRPExtStatus>
</example:LLRP_CUSTOM_MESSAGE>

<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns:example="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
           xmlns="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           targetNamespace="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           elementFormDefault="qualified">

  <xs:import namespace="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
             schemaLocation="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0/llrp.xsd"/>

  <xs:element name="LLRP_CUSTOM_MESSAGE"
              type="example:LLRP_CUSTOM_MESSAGE"/>

  <xs:complexType name="LLRPExtStatus">
    <xs:complexContent>
      <xs:extension base="llrp:LLRPStatus">
        <xs:sequence>
          <xs:element name="ErrorRemedy" type="xs:string"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="LLRP_CUSTOM_MESSAGE">
    <xs:sequence>
      <xs:element name="LLRPExtStatus" type="example:LLRPExtStatus"/>
    </xs:sequence>
    <xs:attributeGroup ref="llrp:headerAttrs"/>
  </xs:complexType>

</xs:schema>

<?xml version="1.0" encoding="utf-8"?>

<example:LLRP_CUSTOM_MESSAGE MessageID="1001"
  xmlns:example="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
  xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
  xmlns="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";>
  <LLRPStatus>
    <StatusCode>M_Success</StatusCode>
    <ErrorDescription></ErrorDescription>
  </LLRPStatus>
</example:LLRP_CUSTOM_MESSAGE>

<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns:example="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           xmlns:llrp="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
           xmlns="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           targetNamespace="http://ltk.example.com/ltk/schema/encoding/xml/0.1";
           elementFormDefault="qualified">

  <xs:import namespace="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0";
             schemaLocation="http://www.llrp.org/ltk/schema/core/encoding/xml/1.0/llrp.xsd"/>

  <xs:element name="LLRP_CUSTOM_MESSAGE"
              type="example:LLRP_CUSTOM_MESSAGE"/>

  <xs:complexType name="LLRP_CUSTOM_MESSAGE">
    <xs:sequence>
      <xs:element ref="llrp:LLRPStatus"/>
    </xs:sequence>
    <xs:attributeGroup ref="llrp:headerAttrs"/>
  </xs:complexType>

</xs:schema>

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
llrp-toolkit-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/llrp-toolkit-devel

Reply via email to