2007/5/20, subbukk <[EMAIL PROTECTED]>:
HI cdrick thanks for your reply
i will tell you in detail.
This is the actual DAML sentence (input) given to the XMLParser
 <daml:Class rdf:ID = "Person">
<rdfs:subClassOf rdf:resource = "#Animal" />
<rdfs:subClassOf>
<daml:Restriction>
<daml:onProperty rdf:resource = "#hasParent" />
<daml:toClass rdf:resource = "#Person" />
</daml:Restriction>
</rdfs:subClassOf>
</daml:Class>
<person rdf:ID = "Joe">
<hasParent rdf:resource = "#John"/>
</person>


Iam parsing this using the code | stream |
[
| tree |
stream := FileStream fileNamed: 'test.daml'.
tree := XMLDOMParser parseDocumentFrom: stream.
tree elements collect: [:each| each name].
] ensure: [stream close].

>From the above code, "tree elements collect: [:each | each name]." actually collects the 
root elements. for example from the above example it collects <daml:class> and <person>. My 
aim is to collect all the elements including attributes and attribute values from that parsed tree in a 
sequeanceable order.
show us the result you'd like for the example sentence...
After collecting it in a sequence i have to store it in a variable, so that i 
can check with that elements with other conditions.
Not sure (and not expert), but I think you should use the SAXParser so
that you navigate the xml tree and do whatever you want with
elements/attributes... The DOMParser is actually building a full tree
for further exploration... can be long and you have to process it
again to get more information... I dit that once to collect wheteher
data for a large xml file... The process is maybe not obvious, you
need to subclass SAXHandler with say DAMLHandler, where you'll
redefine messages likes characters: startDocument: endElement:
startElement:attribute:list:...  but the better is probably to
subclass,   then  you put a    self halt   in the method
startDocument:   and little by little you see how it works... Also,
you'll probably have to create a class where you'll store the
information you want (Meteo class in my case...)...
Sorry, but I cannot help you more on this... really busy for some monthes :'(

Cédrick

ps: I joined my meteo handlers, of course it won't work but it will
give you another example of SAXHandler (that the XMLDOMParser which is
a particular case of SAXHandler)... sorry for the bad code :p

Attachment: SUP-Model-Meteo.st
Description: Binary data

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to