Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing XML with DOM
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 7
Divers
Thread ID:
00962465
Message ID:
00963420
Vues:
10
Hi Terry,
(in text)

>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?

IMHO, XML2.Document can load XML without XSD. If you have any problem , LoadXML() or Load() return .F., You can set property ValidateOnParse=.F.
From MSDN:
Boolean. The property is read/write. If True, it validates during parsing. If False, it parses only for well-formed XML. The default is True.

XML2.Document cannot load XML without DTD.

DTD - you need for loading
XSD - you need not for loading

How work XMLAdapter I Don't know, because I don't need it. I use MS XMLDOM for parsing Jabber XML stream.

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

Hmm. IMHO XML engines load root records from XML and analysing they. If found any informations about DTD or XSD, try load it.



Terry, is big difference between XMLDOM and implementation in XMLDOM in IE or another SW.

MartinJ

>
>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
>>                   time  CDATA #REQUIRED
>>                   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"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> 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"
>>    targetNamespace="urn:don"
>>    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.
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform