[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Schema aware creation of XML.. Question

  • From: David <dlee@calldei.com>
  • To: xml-dev@lists.xml.org
  • Date: Thu, 20 May 2010 11:46:54 -0400

Schema aware creation of XML.. Question
I'm working on a project where I want to create XML according to a 
schema, given not enough information from the data itself.
For example suppose I have a element name and a name/value pair like

     element: record
     name:     field
     value:     "A value"

I want to constantly create a specific XML element from this, say for 
example
<element field="A Value"/>

Or perhaps
<element>
<field>A Value</field>
</element>


The source data does not give me enough data to choose between these 
(and possibly other) representations.
So how to choose ?

I was thinking that if I had a schema (say WSD, DTD, RNG etc ... ) that 
defined the type of element,
I could use the schema information to choose the correct format to create.
I understand there may be ambiguities but am willing to work with a 
subset of data formats to limit these.

Now I know if I use a Schema Aware xslt or XQuery processor, I could do 
the reverse.
That is I could read XML and then validate it against the schema, get 
the types etc.
But I dont know how that will help *generating* XML .
Certainly once I generated the XML I could use  xquery   validate { xml 
}  ... but I want the schema information *before* constructing the XML
(not construct every possible XML values and validate until it succeeds ).

How to do that ?

My thoughts are that I need to use a schema reading tool, probably in 
Java, to read the schema and then use the type information from the schema
to guide in the construction.   But are there other ways ?   I thought 
about reading the schema directly "as XML" (say an XSD or RNG xml 
formatted schema),
but I think that may be very difficult becauase the schema is not fully 
expanded.  There are a lot of "rules" that have to be processed for a 
schema to make sense.

Any other suggestions ? Am I missing some "obvious technology" or tools 
to do this ?

Any ideas very welcome.

-David



-- 
-------------------------
David A. Lee
dlee@calldei.com
http://www.calldei.com
http://www.xmlsh.org



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.