[jdom-interest] Off Topic - Schema and namespaces

Per Norrman per.norrman at austers.se
Tue Aug 23 14:29:49 PDT 2005


Hi,

1. Define TimeCreatedType in its own schema with an explicit targetNamespace 
attribute

2. Import the above schema from the "Message" schema.

3. Reference the imported element with an
    <element ref="pfx:TimeCreatedType" >
    statement

It's all in here: http://www.w3.org/TR/xmlschema-1/#composition

Hope this helps! Otherwise, try this mailing list:
http://lists.w3.org/Archives/Public/xmlschema-dev/

/pmn


Kevin L. Cobb skrev:
> I realize this is off topic and I've exhausted the internet on this 
> topic - nothing seems to work. I hope that someone here is a schema 
> namespace guru or can offere some advice in this direction.
>  
> I've made a relatively simple example to illustrate my problem.
>  
> I have an XML file that has one element in a different namespace.
>  
> <Message>
>  <MessageInformation>
>   <TimeCreated xmlns="http://www.kevindomain.com">123456789</TimeCreated 
> <http://www.kevindomain.com">123456789</TimeCreated>>
>   <MessageType>ORDER</MessageType>
>  </MessageInformation>
> </Message>
> How do I get my schema for the XML set up so that the TimeCreated 
> element is in the correct namespace? My current schema errors on the 
> TimeCreated element because its in a different namespace. I guess I just 
> need the syntax for the schema that says that TimeCreated is in the 
> "kevin" namespace. I just can't get over this hurdle. 
>  
>  
> <?xml version="1.0" encoding="UTF-8"?>
>  
> <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema"
>       xmlns:kevin="http://www.kevindomain.com">
>   
>    <xs:element name="Message">
>       <xs:complexType>
>    <xs:sequence>
>           <xs:element ref="MessageInformation"/>
>        </xs:sequence>
>   </xs:complexType>
>  </xs:element>
>  
>  <xs:element name="MessageInformation">
>   <xs:complexType>
>    <xs:sequence>
>     <xs:element name="TimeCreated" minOccurs="0"/>
>     <xs:element name="MessageType" minOccurs="0"/>
>    </xs:sequence>
>   </xs:complexType>
>  </xs:element>
>  
> </xs:schema>
>  
>  
>  
>  
>  
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> *Kevin L Cobb, MT(ASCP), SCJP2
> *Senior Software Engineer
> Emergint, Inc.
> 2724 River Green Circle
> Louisville, KY 40206
> Kevin.Cobb at emergint.com <mailto:Kevin.Cobb at emergint.com>
> 502.896.6210 ext 255
> 502.896.6170 fax
> 
>  
> 
> The preceding e-mail message and attachments, if any, contains 
> information that is confidential and qualifies as such under the 
> Definition of Confidential Information in the Non-Disclosure Agreement, 
> and may constitute non-public information and trade secrets. It is 
> intended to be conveyed only to the designated recipient(s). If you are 
> not an intended recipient of this message, please notify the sender at 
> 502.896.6210.
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list