473,229 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,229 software developers and data experts.

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 8102
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Snke | last post by:
How can use ASP to read in the ms-word document files the content, then copy the content to access? I attempt ("word.application") have opened with CreateObject to word document only. Can I use...
2
by: Tom | last post by:
Anytime someone wants to open a document, they have to first save it to disk. They cannot simply choose "open". If a user attempts to open the document, they are met with the error message "there was...
4
by: Fabian | last post by:
Hi I want to change the content of text file. I use an StreamReader to read but I can´t use a StreamWriter for the same Stream. What I must do to implement content changing? Thanks for...
0
by: Peter | last post by:
I am having a problem reading an Excel file that is XML based. The directory I am reading contains Excel files that can be of two types. Either generic Microsoft based or XML based. I am reading...
1
by: GaryB | last post by:
Hi, (Posted this in scripting.wsh before I realised that it might be better placed here - sorry if you;ve got two copies) I want my (IE) Intranet users to be able to create a new Word document...
0
by: peter | last post by:
Hi All, I have a template with some VBA code behind and some controls on it such as combo boxes. When I try to create a new document based on this template from C# code it opens fine but the...
1
by: tofu.captain | last post by:
I have PDFs saved in a SQL 2005 server as BLOBs. I would like to extract the BLOBs and either: 1. create a PDF file on the hard disk or 2. open/stream the PDF into the application I am...
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
0
by: Thomas | last post by:
How do you create an XML document based on an XML Schema? I have an XML Schema that defines several primary XML document types (i.e. the top-level element contains 4 complex type child elements...
1
by: Thomas | last post by:
Does anyone have a best practices recommendation on writing a valid XML document based on a 3rd party XML schema? I have a working solution but I would like to know if anyone has a better...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.