Learning more about YAXO

yampa at mindspring.com yampa at mindspring.com
Sat Nov 16 02:14:41 UTC 2002


This is how YAXO works.  Paste this into a workspace so you can try it and
inspect it.

--------------------------------------------- 

xmlDoc topElement| xmlDoc |
	xmlDoc := XMLViewSpecParser fromString: '<?xml version="1.0"
encoding="ISO8859-1" ?> 
 <CATALOG>
 <PLANT>
  <COMMON>Buttercup</COMMON> 
  <BOTANICAL>Ranunculus</BOTANICAL> 
  <ZONE>4</ZONE> 
  <LIGHT>Shade</LIGHT> 
  <PRICE>$2.57</PRICE> 
  <AVAILABILITY>061099</AVAILABILITY> 
  </PLANT>
 <PLANT>
  <COMMON>California Poppy</COMMON> 
  <BOTANICAL>Eschscholzia californica</BOTANICAL> 
  <ZONE>Annual</ZONE> 
  <LIGHT>Sun</LIGHT> 
  <PRICE>$7.89</PRICE> 
  <AVAILABILITY>032799</AVAILABILITY> 
  </PLANT>
  </CATALOG>'.

"------Try these one at a time--------------------------"

"To get the document root:"

	^xmlDoc topElement  "<- I THINK THIS IS WHAT YOU ARE MISSING"

"To get entities:"

"	^xmlDoc topElement entityAt: 'PLANT'"

"To get a collection of entities:"

"	^xmlDoc topElement entities"


"To get attributes: (this document doesn't have any):" 

"	^xmlDoc topElement attributeAt: ''"



More information about the Squeak-dev mailing list