469,270 Members | 1,559 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

How can I create an XSD document based on an XML file content?

Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill

Jun 4 '07 #1
13 7915
I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid XML
message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string" minOccurs="0"
/>
<xs:element name="State" type="xs:string" minOccurs="0"
/>
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType" form="unqualified"
type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate" type="xs:string"
minOccurs="0" />
<xs:element name="EffectiveTime" type="xs:string"
minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId" nillable="true"
minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill

Jun 5 '07 #2
Bill Nguyen wrote:
Is it possible to create your won XSD to use with .NET based on an XML
content?
The .NET framework SDK has a tool named xsd.exe which can do that.

And the .NET framework (2.0 and later) has a class XmlSchemaInference
which has a method InferSchema:
<http://msdn2.microsoft.com/en-us/library/system.xml.schema.xmlschemainference.aspx>


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 5 '07 #3
Jerry;
I don't know how you did it, but I got Invalid XML file message when trying
to generate an XSD!

Bill

"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid XML
message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string" minOccurs="0"
/>
<xs:element name="State" type="xs:string" minOccurs="0"
/>
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType" form="unqualified"
type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate" type="xs:string"
minOccurs="0" />
<xs:element name="EffectiveTime" type="xs:string"
minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId" nillable="true"
minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill


Jun 5 '07 #4
Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It seems
to me that 'pcats' was removed from the xsd file you generated!

Thanks

Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid XML
message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string" minOccurs="0"
/>
<xs:element name="State" type="xs:string" minOccurs="0"
/>
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType" form="unqualified"
type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate" type="xs:string"
minOccurs="0" />
<xs:element name="EffectiveTime" type="xs:string"
minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId" nillable="true"
minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill


Jun 5 '07 #5
Martin;
I used the same XML file and got the same error:

'pcats' is an undeclare namespace. Line 2, position 2.
'pcats' is all over in the XML file.

What Am I missing here?

Thanks

Private Sub SchemaReference()

Dim dPath = "\\nasserver\archive$\FTP\DTN\DTN_PCATS\"

Dim reader As XmlReader = XmlReader.Create(dPath & "testnaxml.xml")

Dim schemaSet As XmlSchemaSet = New XmlSchemaSet()

Dim schema As XmlSchemaInference = New XmlSchemaInference()

schemaSet = schema.InferSchema(reader)

For Each s As XmlSchema In schemaSet.Schemas()

s.Write(Console.Out)

Next

End Sub

--- TESTNAXML.XML --------

<?xml version="1.0"?>
<pcats:NAXML-FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:NAXML-FuelsDoc>


"Martin Honnen" <ma*******@yahoo.dewrote in message
news:uC*************@TK2MSFTNGP06.phx.gbl...
Bill Nguyen wrote:
>Is it possible to create your won XSD to use with .NET based on an XML
content?

The .NET framework SDK has a tool named xsd.exe which can do that.

And the .NET framework (2.0 and later) has a class XmlSchemaInference
which has a method InferSchema:
<http://msdn2.microsoft.com/en-us/library/system.xml.schema.xmlschemainference.aspx>


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Jun 5 '07 #6
Bill Nguyen wrote:
I used the same XML file and got the same error:

'pcats' is an undeclare namespace. Line 2, position 2.
'pcats' is all over in the XML file.
So your XML sample is not well-formed:
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
it needs a namespace declaration for the prefix pcats e.g.
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pcats="http://example.com/ns1"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 5 '07 #7
Yes, I removed the 'pcats' prefix to get it to work. I forgot to include it
in my original reply. When you add the namespace declaration, I hope this
web page works better.

Jerry

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:eN*************@TK2MSFTNGP05.phx.gbl...
Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It seems
to me that 'pcats' was removed from the xsd file you generated!

Thanks

Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid XML
message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string" minOccurs="0"
/>
<xs:element name="State" type="xs:string"
minOccurs="0" />
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType" form="unqualified"
type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate"
type="xs:string" minOccurs="0" />
<xs:element name="EffectiveTime"
type="xs:string" minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId" nillable="true"
minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill



Jun 5 '07 #8
Jerry;
Where do I need to add the 'pcats' namespace declaration?
THanks
Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
Yes, I removed the 'pcats' prefix to get it to work. I forgot to include
it in my original reply. When you add the namespace declaration, I hope
this web page works better.

Jerry

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:eN*************@TK2MSFTNGP05.phx.gbl...
>Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It
seems to me that 'pcats' was removed from the xsd file you generated!

Thanks

Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
>>I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid
XML message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string"
minOccurs="0" />
<xs:element name="State" type="xs:string"
minOccurs="0" />
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType" form="unqualified"
type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate"
type="xs:string" minOccurs="0" />
<xs:element name="EffectiveTime"
type="xs:string" minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId"
nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill





Jun 5 '07 #9
Martin Honnen had an example buried in his message. I added it to the
FuelsDoc declarations as shown below. I also tested it on the web page
(http://www.xmlforasp.net/codebank/sy...enerator.aspx).

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pcats="http://example.com/ns1"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>
"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:u1*************@TK2MSFTNGP05.phx.gbl...
Jerry;
Where do I need to add the 'pcats' namespace declaration?
THanks
Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
>Yes, I removed the 'pcats' prefix to get it to work. I forgot to include
it in my original reply. When you add the namespace declaration, I hope
this web page works better.

Jerry

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:eN*************@TK2MSFTNGP05.phx.gbl...
>>Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It
seems to me that 'pcats' was removed from the xsd file you generated!

Thanks

Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx

Here's the output (after I made some minor changes to make it a valid
XML message):

<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string"
minOccurs="0" />
<xs:element name="State" type="xs:string"
minOccurs="0" />
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix" type="xs:string"
minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate"
type="xs:string" minOccurs="0" />
<xs:element name="EffectiveTime"
type="xs:string" minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId"
nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl. ..
Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:
>
<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>
>
Thanks
>
Bill
>
>
>




Jun 5 '07 #10
Jerry;
You're correct.
I played with the new xsd and it seemed to work , but only for the 1st table
<transmissionHeaderin the dataset.
When I tried to read the <fuelPriceInforecord, I got error since
<terminaland <fuelproductare nested.
Can you please help with the .readxml syntax for nested items?

Thanks

Bill

"Jerry N" <st******@newsgroup.nospamwrote in message
news:u9**************@TK2MSFTNGP05.phx.gbl...
Martin Honnen had an example buried in his message. I added it to the
FuelsDoc declarations as shown below. I also tested it on the web page
(http://www.xmlforasp.net/codebank/sy...enerator.aspx).

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pcats="http://example.com/ns1"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>
"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:u1*************@TK2MSFTNGP05.phx.gbl...
>Jerry;
Where do I need to add the 'pcats' namespace declaration?
THanks
Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
>>Yes, I removed the 'pcats' prefix to get it to work. I forgot to
include it in my original reply. When you add the namespace
declaration, I hope this web page works better.

Jerry

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:eN*************@TK2MSFTNGP05.phx.gbl...
Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It
seems to me that 'pcats' was removed from the xsd file you generated!

Thanks

Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl.. .
I've used this XSD generator and like the output:
http://www.xmlforasp.net/codebank/sy...Generator.aspx
>
Here's the output (after I made some minor changes to make it a valid
XML message):
>
<?xml version="1.0" encoding="utf-16"?>
<xs:schema id="FuelsDoc"
targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="FuelsDoc" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TransmissionHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="TransmissionId" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionDate" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionTime" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionStatus" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionSender" type="xs:string"
minOccurs="0" />
<xs:element name="TransmissionAgency" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="FuelPriceInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="Terminal" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="City" type="xs:string"
minOccurs="0" />
<xs:element name="State" type="xs:string"
minOccurs="0" />
<xs:element name="Name" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="NamePrefix"
type="xs:string" minOccurs="0" msdata:Ordinal="0" />
</xs:sequence>
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
<xs:attribute name="ident" form="unqualified"
type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="FuelProduct" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EffectiveDate"
type="xs:string" minOccurs="0" />
<xs:element name="EffectiveTime"
type="xs:string" minOccurs="0" />
<xs:element name="Price" type="xs:string"
minOccurs="0" />
<xs:element name="NetChange" type="xs:string"
minOccurs="0" />
<xs:element name="FuelProductId"
nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent
msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="identType"
form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
>
"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
>Is it possible to create your won XSD to use with .NET based on an
>XML content?
>For example the one below:
>>
><?xml version="1.0"?>
><pcats:FuelsDoc
>xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xsi:schemaLocation="NAXML-FuelPrice15.xsd">
><pcats:TransmissionHeader>
><pcats:TransmissionId>200706040938</pcats:TransmissionId>
><pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
><pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
><pcats:TransmissionStatus>original</pcats:TransmissionStatus>
><pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
><pcats:TransmissionAgency>DTN Integrated
>Services/dtnDataConnect</pcats:TransmissionAgency>
></pcats:TransmissionHeader>
><pcats:FuelPriceInfo>
><pcats:Terminal>
><pcats:Name identType="PlantNumber" ident="1070">
><pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
></pcats:Name>
><pcats:City>Fresno</pcats:City>
><pcats:State>CA</pcats:State>
><pcats:FuelProduct><pcats:EffectiveDate>200 7-06-04</pcats:EffectiveDate>
><pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
><pcats:FuelProductId identType="Ultra Low Sulfur CARB
>#2">0402</pcats:FuelProductId>
><pcats:Price>2.240000</pcats:Price>
><pcats:NetChange>.040000</pcats:NetChange>
></pcats:FuelProduct>
></pcats:Terminal>
></pcats:FuelPriceInfo>
></pcats:FuelsDoc>
>>
>Thanks
>>
>Bill
>>
>>
>>
>
>



Jun 6 '07 #11
I loaded the generated schema into VS.NET 2005 and it displayed good
diagram. It looks like you're trying to take the next step and load
relational tables into a dataset from an XML file. I would take a look at
"Typed DataSets" and create a separate typed dataset so you can examine the
code that gets generated. You'll need to find out how to create the
ForeignKeyConstraints, etc.

I would also recommend a book "Pragmatic ADO.NET" by Shawn Wildermuth since
it has several chapters on DataSets, Typed DataSets, etc.

Jerry

"Bill Nguyen" <bi**********@jaco.comwrote in message
news:26**********************************@microsof t.com...
Jerry;
You're correct.
I played with the new xsd and it seemed to work , but only for the 1st
table <transmissionHeaderin the dataset.
When I tried to read the <fuelPriceInforecord, I got error since
<terminaland <fuelproductare nested.
Can you please help with the .readxml syntax for nested items?

Thanks

Bill

"Jerry N" <st******@newsgroup.nospamwrote in message
news:u9**************@TK2MSFTNGP05.phx.gbl...
>Martin Honnen had an example buried in his message. I added it to the
FuelsDoc declarations as shown below. I also tested it on the web page
(http://www.xmlforasp.net/codebank/sy...enerator.aspx).

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pcats="http://example.com/ns1"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
><pcats:FuelPriceInfo>
><pcats:Terminal>
><pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
><pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
><pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
></pcats:Terminal>
></pcats:FuelPriceInfo>
></pcats:FuelsDoc>
"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:u1*************@TK2MSFTNGP05.phx.gbl...
>>Jerry;
Where do I need to add the 'pcats' namespace declaration?
THanks
Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
Yes, I removed the 'pcats' prefix to get it to work. I forgot to
include it in my original reply. When you add the namespace
declaration, I hope this web page works better.

Jerry

"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:eN*************@TK2MSFTNGP05.phx.gbl...
Jerry;
I got an error message regarding 'pcats' namespace is undeclared. It
seems to me that 'pcats' was removed from the xsd file you generated!
>
Thanks
>
Bill
"Jerry N" <st******@newsgroup.nospamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl. ..
>I've used this XSD generator and like the output:
>http://www.xmlforasp.net/codebank/sy...Generator.aspx
>>
>Here's the output (after I made some minor changes to make it a valid
>XML message):
>>
><?xml version="1.0" encoding="utf-16"?>
><xs:schema id="FuelsDoc"
>targetNamespace="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
>xmlns:mstns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
>xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
>xmlns:xs="http://www.w3.org/2001/XMLSchema"
>xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
>attributeFormDefault="qualified" elementFormDefault="qualified">
> <xs:element name="FuelsDoc" msdata:IsDataSet="true"
>msdata:UseCurrentLocale="true">
> <xs:complexType>
> <xs:choice minOccurs="0" maxOccurs="unbounded">
> <xs:element name="TransmissionHeader">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="TransmissionId" type="xs:string"
>minOccurs="0" />
> <xs:element name="TransmissionDate" type="xs:string"
>minOccurs="0" />
> <xs:element name="TransmissionTime" type="xs:string"
>minOccurs="0" />
> <xs:element name="TransmissionStatus" type="xs:string"
>minOccurs="0" />
> <xs:element name="TransmissionSender" type="xs:string"
>minOccurs="0" />
> <xs:element name="TransmissionAgency" type="xs:string"
>minOccurs="0" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="FuelPriceInfo">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Terminal" minOccurs="0"
>maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="City" type="xs:string"
>minOccurs="0" />
> <xs:element name="State" type="xs:string"
>minOccurs="0" />
> <xs:element name="Name" minOccurs="0"
>maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="NamePrefix"
>type="xs:string" minOccurs="0" msdata:Ordinal="0" />
> </xs:sequence>
> <xs:attribute name="identType"
>form="unqualified" type="xs:string" />
> <xs:attribute name="ident" form="unqualified"
>type="xs:string" />
> </xs:complexType>
> </xs:element>
> <xs:element name="FuelProduct" minOccurs="0"
>maxOccurs="unbounded">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="EffectiveDate"
>type="xs:string" minOccurs="0" />
> <xs:element name="EffectiveTime"
>type="xs:string" minOccurs="0" />
> <xs:element name="Price" type="xs:string"
>minOccurs="0" />
> <xs:element name="NetChange"
>type="xs:string" minOccurs="0" />
> <xs:element name="FuelProductId"
>nillable="true" minOccurs="0" maxOccurs="unbounded">
> <xs:complexType>
> <xs:simpleContent
>msdata:ColumnName="FuelProductId_Text" msdata:Ordinal="1">
> <xs:extension base="xs:string">
> <xs:attribute name="identType"
>form="unqualified" type="xs:string" />
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:complexType>
> </xs:element>
></xs:schema>
>>
>"Bill Nguyen" <bi*****************@jaco.comwrote in message
>news:%2****************@TK2MSFTNGP04.phx.gbl. ..
>>Is it possible to create your won XSD to use with .NET based on an
>>XML content?
>>For example the one below:
>>>
>><?xml version="1.0"?>
>><pcats:FuelsDoc
>>xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>xsi:schemaLocation="NAXML-FuelPrice15.xsd">
>><pcats:TransmissionHeader>
>><pcats:TransmissionId>200706040938</pcats:TransmissionId>
>><pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
>><pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
>><pcats:TransmissionStatus>original</pcats:TransmissionStatus>
>><pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
>><pcats:TransmissionAgency>DTN Integrated
>>Services/dtnDataConnect</pcats:TransmissionAgency>
>></pcats:TransmissionHeader>
>><pcats:FuelPriceInfo>
>><pcats:Terminal>
>><pcats:Name identType="PlantNumber" ident="1070">
>><pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
>></pcats:Name>
>><pcats:City>Fresno</pcats:City>
>><pcats:State>CA</pcats:State>
>><pcats:FuelProduct><pcats:EffectiveDate>20 07-06-04</pcats:EffectiveDate>
>><pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
>><pcats:FuelProductId identType="Ultra Low Sulfur CARB
>>#2">0402</pcats:FuelProductId>
>><pcats:Price>2.240000</pcats:Price>
>><pcats:NetChange>.040000</pcats:NetChange>
>></pcats:FuelProduct>
>></pcats:Terminal>
>></pcats:FuelPriceInfo>
>></pcats:FuelsDoc>
>>>
>>Thanks
>>>
>>Bill
>>>
>>>
>>>
>>
>>
>
>



Jun 6 '07 #12
You can also load your xml file into VS2005 and click "Create Schema" button
(or access it from the XML menu).
When you load the file into VS, it will also list all the errors you have in
it.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Bill Nguyen" <bi*****************@jaco.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Is it possible to create your won XSD to use with .NET based on an XML
content?
For example the one below:

<?xml version="1.0"?>
<pcats:FuelsDoc
xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="NAXML-FuelPrice15.xsd">
<pcats:TransmissionHeader>
<pcats:TransmissionId>200706040938</pcats:TransmissionId>
<pcats:TransmissionDate>2007-06-04</pcats:TransmissionDate>
<pcats:TransmissionTime>09:38:19-06:00</pcats:TransmissionTime>
<pcats:TransmissionStatus>original</pcats:TransmissionStatus>
<pcats:TransmissionSender>Apex Oil</pcats:TransmissionSender>
<pcats:TransmissionAgency>DTN Integrated
Services/dtnDataConnect</pcats:TransmissionAgency>
</pcats:TransmissionHeader>
<pcats:FuelPriceInfo>
<pcats:Terminal>
<pcats:Name identType="PlantNumber" ident="1070">
<pcats:NamePrefix>Frsn KMEP</pcats:NamePrefix>
</pcats:Name>
<pcats:City>Fresno</pcats:City>
<pcats:State>CA</pcats:State>
<pcats:FuelProduct><pcats:EffectiveDate>2007-06-04</pcats:EffectiveDate>
<pcats:EffectiveTime>10:00:00</pcats:EffectiveTime>
<pcats:FuelProductId identType="Ultra Low Sulfur CARB
#2">0402</pcats:FuelProductId>
<pcats:Price>2.240000</pcats:Price>
<pcats:NetChange>.040000</pcats:NetChange>
</pcats:FuelProduct>
</pcats:Terminal>
</pcats:FuelPriceInfo>
</pcats:FuelsDoc>

Thanks

Bill

Jun 7 '07 #13
Hello! Good Site! Thanks you! cxdgkijybd
Jun 21 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Fabian | last post: by
reply views Thread by peter | last post: by
1 post views Thread by tofu.captain | last post: by
1 post views Thread by ujjwaltrivedi | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.