Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Schema to express fixed length fields within a tag.

From: George Cristian Bina <george@---------.--->
To: kurt steele <kurtsteele@-----.--->
Date: 9/28/2005 12:53:00 PM
Hi Kurt,

You can define a type as a list of 5 decimal numbers like in the sample 
below.

test.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
     <xs:element name="test" type="restrictedList"/>

     <xs:simpleType name="list">
         <xs:list itemType="xs:decimal">
         </xs:list>
     </xs:simpleType>
     <xs:simpleType name="restrictedList">
         <xs:restriction base="list">
             <xs:length value="5"/>
         </xs:restriction>
     </xs:simpleType>
</xs:schema>

test.xml
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="test.xsd">8.5  6.54 3.11 6.76 
123.0</test>

 >Can a reference to a stylesheet be embededded in a schema
 > such as to say, "apply this transform to the data before validating"?

I'm not aware of something like this but there is Schematron that can be 
embedded in XML Schema and can be used to perform complex checks as it 
uses XPath.

Hope that helps,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


kurt steele wrote:
> I have an XML document containing this set of fixed-length within a tag:
>  
> <?xml version="1.0"?>
> <data>8.5  6.54 3.11 6.76 123.0</data>
>  
> These are dew point readings from a sensor, each field is 5 bytes 
> long. What would be a schema for this instance?  Can a schema describe 
> untagged data?
>  
> The real data is complex, coming from many sensors and having a 
> structured hierarchy but the above sample articulates the use-case 
> adequately.  I do not want to tag every data element as bandwidth varies 
> greatly. 
>  
> Right now I let this lite XML to flow over the wireless connection then 
> use XSL to generate a fully tagged document. My schema describes 
> the latter.  Can a reference to a stylesheet be embededded in a schema 
> such as to say, "apply this transform to the data before validating"?
>  
> Thanks.
>  
> Kurt Steele
> Engineer
> Northrop-Grumman
>  
>  
>  
>  
>  
> 
>  
> 
>  
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 

From petexmldev@t... Wed Sep 28 07:24:23 2005
Received: from maggie.w3.org ([193.51.208.68])
	by fri


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent