Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Apress
committed
Oct 5, 2016
0 parents
commit 1a2e688
Showing
176 changed files
with
2,170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Chapter 1 Welcome to ColdFusion MX 6.1<br /> | ||
Chapter 2 Databases and Dreamweaver MX 2004<br /> | ||
Chapter 3 Introduction to ColdFusion Markup Language <br /> | ||
Chapter 4 ColdFusion Variables and Logic<br /> | ||
Chapter 5 Form Processing<br /> | ||
Chapter 6 Database Manipulation<br /> | ||
Chapter 7 Maintaining State<br /> | ||
Chapter 8 Exception Handling with CFML<br /> | ||
Chapter 9 Dreamweaver MX 2004 Extensions<br /> | ||
Chapter 10 Code and Component Reuse<br /> | ||
Chapter 11 Working with XML in ColdFusion MX 6.1<br /> | ||
Chapter 12 Flash MX 2004, Web Services, and ColdFusion MX 6.1<br /> | ||
Chapter 13 Case Study: A Complete ColdFusion-Based Web Site |
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Freeware License, some rights reserved | ||
|
||
Copyright (c) 2004 Peter de Haan, Curtis Hermann, Simon Horwith, Edoardo Zubler, and Massimo Foti | ||
|
||
Permission is hereby granted, free of charge, to anyone obtaining a copy | ||
of this software and associated documentation files (the "Software"), | ||
to work with the Software within the limits of freeware distribution and fair use. | ||
This includes the rights to use, copy, and modify the Software for personal use. | ||
Users are also allowed and encouraged to submit corrections and modifications | ||
to the Software for the benefit of other users. | ||
|
||
It is not allowed to reuse, modify, or redistribute the Software for | ||
commercial use in any way, or for a user�s educational materials such as books | ||
or blog articles without prior permission from the copyright holder. | ||
|
||
The above copyright notice and this permission notice need to be included | ||
in all copies or substantial portions of the software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#Apress Source Code | ||
|
||
This repository accompanies [*ColdFusion Web Development with Macromedia Dreamweaver MX 2004*](http://www.apress.com/9781590592373) by Peter de Haan, Curtis Hermann, Simon Horwith, Edoardo Zubler, and Massimo Foti (Apress, 2004). | ||
|
||
![Cover image](9781590592373.jpg) | ||
|
||
Download the files as a zip using the green button, or clone the repository to your machine using Git. | ||
|
||
##Releases | ||
|
||
Release v1.0 corresponds to the code in the published book, without corrections or updates. | ||
|
||
##Contributions | ||
|
||
See the file Contributing.md for more information on how you can contribute to this repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<figs> | ||
<employee fname="Simon" lname="Horwith" /> | ||
<employee fname="Dave" lname="Watts" /> | ||
<employee fname="Steve" lname="Drucker" /> | ||
</figs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" | ||
xmlns="http://www.w3.org/TR/REC-html40" | ||
xmlns:xlink="http://www.w3.org/1999/xlink"> | ||
<xsl:template match="/"> | ||
<html> | ||
<head> | ||
<title>Active Employees</title> | ||
</head> | ||
|
||
<body> | ||
<table border="1" width="350"> | ||
<tr> | ||
<th>First Name</th> | ||
<th>Last Name</th> | ||
</tr> | ||
<xsl:for-each select="/figs/employee"> | ||
<xsl:if test="active=1"> | ||
<tr> | ||
<td align="center"><xsl:value-of select="@fname"/></td> | ||
<td align="center"><xsl:value-of select="@lname"/></td> | ||
</tr> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</table> | ||
|
||
</body> | ||
</html> | ||
|
||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<figs> | ||
<employee fname="Simon" lname="Horwith"/> | ||
<employee fname="Dave" lname="Watts"/> | ||
<employee fname="Steve" lname="Drucker"/> | ||
</figs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<figs> | ||
<employee fname="Simon" lname="Horwith" /> | ||
<employee fname="Dave" lname="Watts" /> | ||
<contractor fname="Charles" lname="Arehart" /> | ||
<contractor fname="Branden" lname="Hall" /> | ||
<employee fname="Steve" lname="Drucker" /> | ||
</figs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<figs> | ||
<employee id="1" fname="Simon" lname="Horwith"> | ||
<active>1</active> | ||
</employee> | ||
<employee id="2" fname="Dave" lname="Watts"> | ||
<active>1</active> | ||
</employee> | ||
<contractor id="1" fname="Charles" lname="Arehart"> | ||
<active>1</active> | ||
</contractor> | ||
<contractor id="2" fname="Branden" lname="Hall"> | ||
<active>1</active> | ||
</contractor> | ||
<employee id="3" fname="Steve" lname="Drucker"> | ||
<active>1</active> | ||
</employee> | ||
</figs> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<cfquery name="qEmployee" datasource="CompanyInfo"> | ||
SELECT * FROM Employee ORDER BY Employee.Emp_ID, Employee.FirstName, Employee.LastName | ||
</cfquery> | ||
<cfxml variable="xmlEmps"> | ||
<employees> | ||
<cfoutput query="qEmployee"> | ||
<employee id="#qEmployee.emp_ID#" fname="#xmlFormat(qEmployee.FirstName)#" lname="#xmlFormat(qEmployee.LastName)#" /> | ||
</cfoutput> | ||
</employees> | ||
</cfxml> | ||
<cfdump var = "#xmlEmps#"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata.xml"; | ||
</cfscript> | ||
|
||
|
||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
|
||
|
||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
|
||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
|
||
<cfscript> | ||
// use structure syntax to set the "lname" attribute of the first node to "Badhwar" | ||
variables.myXMLDOM.figs.employee.XMLAttributes.lname = "Badhwar"; | ||
</cfscript> | ||
|
||
|
||
|
||
|
||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata1.xml"; | ||
</cfscript> | ||
|
||
|
||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
|
||
|
||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
|
||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
|
||
<cfscript> | ||
// find out how many employee elements there are | ||
numContractors = arrayLen(variables.myXMLDOM.figs.employee); | ||
// if there are at least 3 employees, find out where the third employee is in the child elements array | ||
thirdEmployeePos = XMLChildPos(variables.myXMLDOM.figs,"employee",3); | ||
thirdEmployeeNode = variables.myXMLDOM.XMLroot.XMLChildren[variables.thirdEmployeePos]; | ||
</cfscript> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata2.xml"; | ||
</cfscript> | ||
|
||
|
||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
|
||
|
||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
|
||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
|
||
<cfscript> | ||
//get all employees that have an fname of "Simon" OR that have a nested "<active>0</active>" child | ||
aSimonOrInactive = XMLSearch(myXMLDOM,"//employee[@fname='Simon' or active=0]"); | ||
</cfscript> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!---:: create XML DOM ::---> | ||
<cfxml variable="myXMLDOM"> | ||
<figs> | ||
<employee id="1" fname="Simon" lname="Horwith"> | ||
<active>1</active> | ||
</employee> | ||
<employee id="2" fname="Dave" lname="Watts"> | ||
<active>1</active> | ||
</employee> | ||
<contractor id="1" fname="Charles" lname="Arehart"> | ||
<active>1</active> | ||
</contractor> | ||
<contractor id="2" fname="Branden" lname="Hall"> | ||
<active>1</active> | ||
</contractor> | ||
<employee id="3" fname="Steve" lname="Drucker"> | ||
<active>1</active> | ||
</employee> | ||
<employee id="4" fname="Dave" lname="Gallerizzo"> | ||
<active>0</active> | ||
</employee> | ||
</figs> | ||
</cfxml> | ||
|
||
<cffile action="read" variable="myXSL" file="#expandPath('.')#\figsXSL.xsl"> | ||
|
||
<cfset transformedXML = XMLTransform(variables.myXMLDOM, variables.myXSL)> | ||
<cfoutput>#variables.transformedXML#</cfoutput> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<cfscript> | ||
//create object and initialize root element | ||
xmlEmps = XMLNew(); | ||
xmlEmps.xmlRoot = XMLElemNew(xmlEmps, "employees"); | ||
//add first child element | ||
xmlEmps.xmlRoot.xmlChildren[1] = XMLElemNew(xmlEmps,"employee"); | ||
xmlEmps.xmlRoot.xmlChildren[1].XMLAttributes.id = "1"; | ||
xmlEmps.xmlRoot.xmlChildren[1].XMLAttributes.fname = "Simon"; | ||
xmlEmps.xmlRoot.xmlChildren[1].XMLAttributes.lname = "Horwith"; | ||
//add second child element | ||
xmlEmps.xmlRoot.xmlChildren[2] = XMLElemNew(xmlEmps,"employee"); | ||
xmlEmps.xmlRoot.xmlChildren[2].XMLAttributes.id = "2"; | ||
xmlEmps.xmlRoot.xmlChildren[2].XMLAttributes.fname = "Dave"; | ||
xmlEmps.xmlRoot.xmlChildren[2].XMLAttributes.lname = "Watts"; | ||
//add third child element using slightly different syntax to reference the root | ||
xmlEmps.xmlRoot.xmlChildren[3] = XMLElemNew(xmlEmps,"employee"); | ||
xmlEmps.employees.xmlChildren[3].XMLAttributes.id = "3"; | ||
xmlEmps.employees.xmlChildren[3].XMLAttributes.fname = "Steve"; | ||
xmlEmps.employees.xmlChildren[3].XMLAttributes.lname = "Drucker"; | ||
</cfscript> | ||
<!---:: output xml object ::---> | ||
<cfdump var="#variables.xmlEmps#"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata.xml"; | ||
</cfscript> | ||
<cfif not fileExists(variables.targetXMLFile)> | ||
<h3>Can't find target xml file</h3> | ||
<cfabort> | ||
</cfif> | ||
<cftry> | ||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
<cfcatch> | ||
<h3>error opening XML file!</h3> | ||
<cfabort> | ||
</cfcatch> | ||
</cftry> | ||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
<cftry> | ||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
<cfcatch> | ||
<h3>Error parsing XML!</h3> | ||
<cfabort> | ||
</cfcatch> | ||
</cftry> | ||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
<cfset newXMLString = toString(variables.myXMLDOM)> | ||
<cftry> | ||
<cffile action="write" file="#variables.targetXMLFile#" output="#variables.newXMLString#"> | ||
<cfcatch> | ||
<h3>Error Writing to text file!</h3> | ||
<cfabort> | ||
</cfcatch> | ||
</cftry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata.xml"; | ||
</cfscript> | ||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
<cfscript> | ||
// add an 'active' attribute to all XML Children off the DOM root | ||
for (i = 1; i LTE arrayLen(variables.myXMLDOM.XMLRoot.XMLChildren); i = i + 1) | ||
{structInsert(variables.myXMLDOM.XMLRoot.XMLChildren[i].XMLAttributes,"inactive",1,1);} | ||
</cfscript> | ||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata.xml"; | ||
</cfscript> | ||
|
||
|
||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
|
||
|
||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
|
||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
|
||
<cfscript> | ||
// get array position of next XML child to add | ||
newNodePos = arrayLen(variables.myXMLDOM.XMLRoot.XMLChildren) + 1; | ||
// add new node then set it's attributes | ||
variables.myXMLDOM.XMLRoot.XMLChildren[variables.newNodePos] = XMLElemNew(myXMLDOM,"employee"); | ||
structInsert(variables.myXMLDOM.XMLRoot.XMLChildren[variables.newNodePos].XMLAttributes,"fname","Ashu",1); structInsert(variables.myXMLDOM.XMLRoot.XMLChildren[variables.newNodePos].XMLAttributes,"lname","Courchesne",1); | ||
structInsert(variables.myXMLDOM.XMLRoot.XMLChildren[variables.newNodePos].XMLAttributes,"active",1,1); | ||
</cfscript> | ||
|
||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<cfscript> | ||
thisDir = expandPath('.'); | ||
targetXMLFile = variables.thisDir & "\mydata.xml"; | ||
</cfscript> | ||
|
||
|
||
<cffile action="read" file="#variables.targetXMLFile#" variable="originalXMLString"> | ||
|
||
|
||
<cfset originalXMLString = replace(variables.originalXMLString,chr(13),"","All")> | ||
|
||
|
||
<cfset myXMLDOM = XMLParse(variables.originalXMLString)> | ||
|
||
<cfscript> | ||
//set the first employee's last name to 'Badhwar' | ||
variables.myXMLDOM.XMLRoot.XMLChildren[1].XMLAttributes.lname = "Badhwar"; | ||
</cfscript> | ||
|
||
|
||
|
||
<cfdump var="#myXMLDOM#" label="My XML Packet From File"> | ||
|
||
|
||
|
Oops, something went wrong.