Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 5, 2016
0 parents commit 1a2e688
Show file tree
Hide file tree
Showing 176 changed files with 2,170 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 1034.html
@@ -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 added 1570.pdf
Binary file not shown.
Binary file added 1572.pdf
Binary file not shown.
Binary file added 9781590592373.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -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.


15 changes: 15 additions & 0 deletions README.md
@@ -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.
6 changes: 6 additions & 0 deletions ch11/employees.xml
@@ -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>
31 changes: 31 additions & 0 deletions ch11/figsXSL.xsl
@@ -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>
6 changes: 6 additions & 0 deletions ch11/mydata.xml
@@ -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>
8 changes: 8 additions & 0 deletions ch11/mydata1.xml
@@ -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>
19 changes: 19 additions & 0 deletions ch11/mydata2.xml
@@ -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>

11 changes: 11 additions & 0 deletions ch11/xmldom.cfm
@@ -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#">
27 changes: 27 additions & 0 deletions ch11/xmldom10.cfm
@@ -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">



31 changes: 31 additions & 0 deletions ch11/xmldom11.cfm
@@ -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">



29 changes: 29 additions & 0 deletions ch11/xmldom12.cfm
@@ -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">



28 changes: 28 additions & 0 deletions ch11/xmldom13.cfm
@@ -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>
22 changes: 22 additions & 0 deletions ch11/xmldom2.cfm
@@ -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#">
35 changes: 35 additions & 0 deletions ch11/xmldom3.cfm
@@ -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>
16 changes: 16 additions & 0 deletions ch11/xmldom4.cfm
@@ -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">



28 changes: 28 additions & 0 deletions ch11/xmldom5.cfm
@@ -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">



25 changes: 25 additions & 0 deletions ch11/xmldom6.cfm
@@ -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">



0 comments on commit 1a2e688

Please sign in to comment.