- From: Choon Tan <tct13@yahoo.com>
- Date: Wed, 15 Aug 2001 10:06:00 -0700 (PDT)
- To: xmlschema-dev@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. ------------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 13:06:02 UTC