Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing XML with DOM
Message
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
00962465
Message ID:
00963222
Views:
7
Martin,
I am doing some stuff with DOMDocument3.0. The XMLs I work with are "third-party" JSEE compliant and have had no success with XML Cursor Adapter, regardless of the XSDs and DTD availability.

Do XML2.DOMDocument or XMLAdapter OPEN or reference XSD or DTDs at LoadXML, or would they produce an error if an XSD/DTD was missing?

How do these XML Engines use the XSD and DTD's?

Thanks
Terry

>Hi Don,
>
>Your XML is invalid because have not root element.
>Exapmples:
>
>XML & DTD
>don2.xml
>
><?xml version="1.0" encoding="windows-1252" standalone="yes"?>
><!DOCTYPE DOCUMENT SYSTEM "don2.dtd">
><root>
> <schedule time="1" display="45" program="xx76578" />
> <data>
>  <data1>xxx</data1>
>  <data2>XXX</data2>
> </data>
></root>
>
>
>don2.dtd
>
><?xml version="1.0" encoding="windows-1252"?>
>ELEMENT root (schedule,data)
>
>ELEMENT schedule (#PCDATA)
>ATTLIST schedule program  CDATA #REQUIRED
&gt;                   time  CDATA #REQUIRED
&gt;                   display CDATA #REQUIRED 
>
>ELEMENT data (#PCDATA)
>ELEMENT data (data1,data2)
>
>ELEMENT data1 (#PCDATA)
>
>ELEMENT data2 (#PCDATA)
>
>
>
>
>XML & XSD
>don.xml
>
><?xml version="1.0" encoding="windows-1252" standalone="yes"?>
><root xmlns="urn:don"
&gt; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&gt; xsi:schemaLocation="urn:don don.xsd">
>
> <schedule time="1" display="45" program="xx76578" />
> <data>
>  <data1>xxx</data1>
>  <data2>XXX</data2>
> </data>
>
></root>
>
>
>don.xsd
>
><?xml version="1.0" encoding="windows-1252" standalone="yes"?>
><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
&gt;    targetNamespace="urn:don"
&gt;    xmlns="urn:don" elementFormDefault="qualified">
>
> <xs:complexType name="dataelement">
> </xs:complexType>
>
> <xs:complexType name="dataelements">
>  <xs:sequence>
>   <xs:element name="data1" type="dataelement" minOccurs="1" maxOccurs="1" />
>   <xs:element name="data2" type="dataelement" minOccurs="1" maxOccurs="1" />
>  </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="schemaelement">
>  <xs:attribute name="program" type="xs:string" use="required" />
>  <xs:attribute name="type" type="xs:int" use="required" />
>  <xs:attribute name="time" type="xs:float" use="required" />
> </xs:complexType>
>
> <xs:complexType name="root">
>  <xs:sequence>
>   <xs:element name="scheme" type="schemaelement" minOccurs="1" maxOccurs="1" />
>   <xs:element name="data" type="dataelements" minOccurs="1" maxOccurs="1" />
>  </xs:sequence>
> </xs:complexType>
>
> </xs:element>
></xs:schema>
>
>
>MartinJ
>
>>Well I'll be @!#*. You are right. I've been running in circles trying to figure out how to write schemas and dtd's and never thought to try the xmltocursor on this piece of data. The sample of course is only part of a much more complex file that has data in mixed forms like that shown (mixed between <>) and also other parts where the data is separated into discrete elements like:
>>
>>
>><schedule time=1 display=45 program=xx76578 />
>><data>
>><data1>xxx</data1>
>><data2>XXX</data2>
>></data>
>>
>>
>>Can you give me some help on how to write a schema to deal with this? I'd prefer to do the whole job in VFP if I can.
>>
>>Thanks for your tip.
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform