XML By Eric Korson (View cars.xml)

<?xml version="1.0" encoding="utf-8"?>
<!-- Erics cars.xml Example -->
<company name="General Motors">
	<car carid="1">
		 <carname>Buick Enclave</carname>
		 <caryear>2008</caryear>
		 <cardescription>Big, quiet, old-fashioned Buick</cardescription>
	</car>   
	<car carid="2">
		 <carname>Chevrolet Aveo5</carname>
		 <caryear>2009</caryear>
		 <cardescription>GM's best kept secret with superior suspension.</cardescription>
	</car>  
	<car carid="3">
		 <carname>Pontiac G8 GXP</carname>
		 <caryear>2009</caryear>
		 <cardescription>High-tech, four-door muscle car</cardescription>
	</car> 	  
</company>
ColdFusion Code:

Is myXmlObject a valid XML Document Object: YES
The name of the root element is: company
The company name is: General Motors
Is company really the root element? YES
Is company an XML element? YES
How many child elements does the root element company have? 3

XML Contents

[Element 1 car]
carid: 1
carname = Buick Enclave
caryear = 2008
cardescription = Big, quiet, old-fashioned Buick
[Element 2 car]
carid: 2
carname = Chevrolet Aveo5
caryear = 2009
cardescription = GM's best kept secret with superior suspension.
[Element 3 car]
carid: 3
carname = Pontiac G8 GXP
caryear = 2009
cardescription = High-tech, four-door muscle car

The index position of the second occurence of "car" is: 2

Deleting the child element [cardescription] at element position: 3

myXmlObject - xml document [short version]
XmlComment Erics cars.xml Example
XmlRoot
myXmlObject - xml element
XmlNamecompany
XmlNsPrefix
XmlNsURI
XmlText
XmlComment
XmlAttributes
myXmlObject - struct
name General Motors
XmlChildren
myXmlObject - xml element
XmlNamecar
XmlNsPrefix
XmlNsURI
XmlText
XmlComment
XmlAttributes
myXmlObject - struct
carid 1
XmlChildren
myXmlObject - xml element
XmlNamecarname
XmlNsPrefix
XmlNsURI
XmlTextBuick Enclave
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecaryear
XmlNsPrefix
XmlNsURI
XmlText2008
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecardescription
XmlNsPrefix
XmlNsURI
XmlTextBig, quiet, old-fashioned Buick
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecar
XmlNsPrefix
XmlNsURI
XmlText
XmlComment
XmlAttributes
myXmlObject - struct
carid 2
XmlChildren
myXmlObject - xml element
XmlNamecarname
XmlNsPrefix
XmlNsURI
XmlTextChevrolet Aveo5
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecaryear
XmlNsPrefix
XmlNsURI
XmlText2009
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecar
XmlNsPrefix
XmlNsURI
XmlText
XmlComment
XmlAttributes
myXmlObject - struct
carid 3
XmlChildren
myXmlObject - xml element
XmlNamecarname
XmlNsPrefix
XmlNsURI
XmlTextPontiac G8 GXP
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecaryear
XmlNsPrefix
XmlNsURI
XmlText2009
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
myXmlObject - xml element
XmlNamecardescription
XmlNsPrefix
XmlNsURI
XmlTextHigh-tech, four-door muscle car
XmlComment
XmlAttributes
myXmlObject - struct [empty]
XmlChildren
company
XmlText
XmlAttributes
myXmlObject - struct
name General Motors
car
XmlText
XmlAttributes
myXmlObject - struct
carid 1
carname
XmlTextBuick Enclave
caryear
XmlText2008
cardescription
XmlTextBig, quiet, old-fashioned Buick
car
XmlText
XmlAttributes
myXmlObject - struct
carid 2
carname
XmlTextChevrolet Aveo5
caryear
XmlText2009
car
XmlText
XmlAttributes
myXmlObject - struct
carid 3
carname
XmlTextPontiac G8 GXP
caryear
XmlText2009
cardescription
XmlTextHigh-tech, four-door muscle car

Back To Top