Questions of a beginner...

Sophie MABILAT Sophie.Mabilat at apitech.fr
Wed Jan 19 16:46:57 GMT 2000


Hi,
I would like to transform an XML document produced by the command rs.Save
Doc, adPersistXML (so with XML Reduced Data format) in an other XML document
which only contain elements.

So I would like to transform this :
<datas>
	<row colonne1="value11" colonne2="value12" colonne i="value1i".../>
	<row colonne1="value21" colonne2="value22" colonne i="value2i".../>
	<row colonne1="value31" colonne2="value32" colonne i="value3i".../>
	...
</datas>

in this :

<datas>
	<row>
		<colonne1>value11</colonne1>
		<colonne2>value12</colonne2>
		<colonnei>value1i</colonnei>
		...
	</row>
	<row>
		<colonne1>value21</colonne1>
		<colonne2>value22</colonne2>
		<colonnei>value2i</colonnei>
		...
	</row>
	<row>
		<colonne1>value31</colonne1>
		<colonne2>value32</colonne2>
		<colonnei>value3i</colonnei>
		...
	</row>
	...
</datas>

I succeed to make this transformation using the DOM. My problems are :
- is an other programmed transformation using the DOM the best solution to
adapt the schema description generated during the save operation ?
Original schema :
<s:Schema id="RowsetSchema">
	<s:ElementType name="row" content="eltOnly" rs:CommandTimeout="30"
rs:updatable="true" rs:ReshapeName="DSRowset1">
		<s:AttributeType name="Colonne1" rs:number="1"
rs:basecatalog="BaseExemple" rs:basetable="TableExemple"
rs:basecolumn="Colonne1" 			rs:keycolumn="true"
rs:autoincrement="true">
			<s:datatype dt:type="int" dt:maxLength="4"
rs:precision="10" rs:fixedlength="true" rs:maybenull="false"/>
		</s:AttributeType>
		<s:AttributeType name="Colonne2" rs:number="2"
rs:writeunknown="true" rs:basecatalog="BaseExemple"
rs:basetable="TableExemple"
rs:basecolumn="Colonne2">
			<s:datatype dt:type="string" dt:maxLength="20"
rs:maybenull="false"/>
		</s:AttributeType>
		<s:AttributeType name="Colonne3" rs:number="3"
rs:writeunknown="true" rs:basecatalog="BaseExemple"
rs:basetable="TableExemple"
rs:basecolumn="Colonne3">
			<s:datatype dt:type="string" dt:maxLength="10"
rs:maybenull="false"/>
		</s:AttributeType>
		<s:AttributeType name="Colonne4" rs:number="4"
rs:nullable="true" rs:writeunknown="true" rs:basecatalog="BaseExemple"
rs:basetable="TableExemple" 		rs:basecolumn="Colonne4">
			<s:datatype dt:type="string" dt:maxLength="30"/>
		</s:AttributeType>
		<s:AttributeType name="Colonne5" rs:number="5"
rs:nullable="true" rs:writeunknown="true" rs:basecatalog="BaseExemple"
rs:basetable="TableExemple" 		rs:basecolumn="Colonne5">
			<s:datatype dt:type="dateTime" rs:dbtype="timestamp"
dt:maxLength="16" rs:scale="3" rs:precision="23" rs:fixedlength="true"/>
		</s:AttributeType>
		<s:extends type="rs:rowbase"/>
	</s:ElementType>
</s:Schema>
- is this schema description right to the final document ?
Final schema :
<Schema name="ShemaNomTableOuVue"
	xmlns = "urn:schemas-microsoft-com:xml-data"
        	xmlns:dt="urn:schemas-microsoft-com:datatypes">
 
 	<ElementType name="colonne1" rs:number="1"
rs:basecatalog="BaseExemple" rs:basetable="TableExemple"
rs:basecolumn="colonne1" rs:keycolumn="true" 	rs:autoincrement="true">
		<s:datatype dt:type="int" dt:maxLength="4" rs:precision="10"
rs:fixedlength="true" rs:maybenull="false"/>
	</ElementType>
    	<ElementType name="colonne2" rs:number="2" rs:writeunknown="true"
rs:basecatalog="BaseExemple" rs:basetable="TableExemple"
rs:basecolumn="colonne2">
		<s:datatype dt:type="string" dt:maxLength="20"
rs:maybenull="false"/>
	</ElementType>
    ...
    <ElementType name="row" content="eltOnly" model="closed">
        <element type="colonne1" minOcurs="1" maxOccurs="1"/>
        <element type="colonne2" minOcurs="1" maxOccurs="1"/>
        ...
    </ElementType>
    
    <ElementType name="datas" content="eltOnly" model="closed">
      	<element type="row" minOcurs="1" maxOccurs="*"/>
    </ElementType>
</Schema>
- how to add by programmation a XML version declaration, then the schema
part and the datas one in a same XML document ?
- how can I verify programmaticaly than my datas part is valid according to
my description schema ?

Please help me...
Sophie

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sophie MABILAT
Sophie.Mabilat at apitech.fr

APITECH 113, rue Marietton 69009 LYON FRANCE
Tél. : 04 78 43 49 30   Fax : 04 78 83 47 86
www.apitech.fr
www.zipbee.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions now closed in preparation for transfer to OASIS.





More information about the Xml-dev mailing list