Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Off Topic - Schema and namespaces

Kevin L. Cobb

2005-08-23

Replies:

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>
  <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@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@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.