W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

valid Dom / xml data file from the xsl schema file

From: Choon Tan <tct13@yahoo.com>
Date: Wed, 15 Aug 2001 09:56:59 -0700 (PDT)
Message-ID: <20010815165659.66401.qmail@web9506.mail.yahoo.com>
To: www-dom@w3.org
Hiya,

I have the following xml schema file which I parse to a dom1.
But having the dom1, I want to walk around it to produce another
dom2 (that represents the valid xml data file to be seralised
later to a file).

I have difficulties:

1. understanding what the valid xml file looks like because I am
confused about the bit on the xsd:ID and xsd:IDREF. (not really
a dom question but linked to it)

------------rough xml file structure or dom-------------

<XEX-data>
	<stock_info>
		<a_stock_name>vhg</a_stock_name>
		<b_stock_acronym>vhg</b_stock_acronym>
		<c_price_info>
			<d_daily_price_data>1.2</d_daily_price_data>
			<d_daily_price_data>1.1</d_daily_price_data>
		</c_price_info>
	</stock_info>
</XEX-data>


2. how I can walk dom1 to create dom2? is tree walker the
easiest to implemement? How do I deal with the the xsd:choice
node where only one of the nodes will be created?


Thanks in advance, braden.

----------xml schema------------------
<?xml version="1.0"?>

<xsd:schema elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--  entity
complex type delaration : stock_info  -->
<xsd:complexType
name="stock_info-type"><xsd:sequence><xsd:element
name="a_stock_name"><xsd:simpleType><xsd:restriction
base="xsd:string"></xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element
name="b_stock_acronym"><xsd:simpleType><xsd:restriction
base="xsd:string"></xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element
name="c_price_info"><xsd:simpleType><xsd:restriction
base="xsd:IDREF"></xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"
use="required"></xsd:attribute>
</xsd:complexType>
<!--  entity complex type delaration : price_data_info  -->
<xsd:complexType
name="price_data_info-type"><xsd:sequence><xsd:element
name="d_daily_price_data"><xsd:complexType><xsd:sequence><xsd:element
minOccurs="1"
name="Array"><xsd:complexType><xsd:sequence><xsd:element
maxOccurs="250" minOccurs="1"
name="Value"><xsd:simpleType><xsd:restriction
base="xsd:float"></xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"
use="required"></xsd:attribute>
</xsd:complexType>
<xsd:element name="price_data_info"
type="price_data_info-type"></xsd:element>
<xsd:element name="stock_info"
type="stock_info-type"></xsd:element>
<xsd:element name="XEX-data"><xsd:complexType><xsd:choice
maxOccurs="unbounded"><xsd:element
ref="price_data_info"></xsd:element>
<xsd:element ref="stock_info"></xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
Received on Wednesday, 15 August 2001 12:57:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT