meryls
04-15-2007, 09:09 AM
I am receiving this data in an xml file and have no idea how to parse and extract the data in a meaningful way. Every example I've seen in xml books and on xml websites uses elements and not attributes. Here is an example of this data:
<service_order_report>
−
<service_order project_name="ABC" service_order_number="33" author="bobw" report_to_group="dev" report_to_individual="leos" date_opened="2007-04-13 12:37:38.972" date_resolved="Unresolved" reported_by="bobw" reported_version="ABC2007" resolved_version="ABC007" resolved="false" due_date="2007-04-30" customer="N/A" total_cost="$0.00">
−
<attribute label="Company, Contact, Email, Phone">
Mispelled word in instructions on login page
</attribute>
<attribute label="Priority">Low</attribute>
<attribute label="Severity">Low</attribute>
<attribute label="Software Release">ABC2007</attribute>
<attribute label="Category">Customer-Low</attribute>
<attribute label="Build Type">Monthly</attribute>
<attribute label="Module">GUI</attribute>
<attribute label="Status">Assigned</attribute>
</service_order>
The originators of this xml provided a dtd:
<?xml version="1.0" encoding="UTF-8" ?>
<!ELEMENT service_order ( attribute*,
description*,
comment*,
resolution*,
attachment*,
billing*) >
<!ATTLIST service_order project_name CDATA #REQUIRED
service_order_number CDATA #REQUIRED
author CDATA #REQUIRED
report_to_group CDATA #REQUIRED
report_to_individual CDATA #REQUIRED
date_opened CDATA #REQUIRED
date_resolved CDATA #REQUIRED
reported_by CDATA #REQUIRED
reported_version CDATA #REQUIRED
resolved_version CDATA #REQUIRED
resolved ( true | false ) #REQUIRED
due_date CDATA #REQUIRED
customer CDATA #REQUIRED
total_cost CDATA #REQUIRED >
<!ELEMENT attribute ( #PCDATA ) >
<!ATTLIST attribute label CDATA #REQUIRED >
<!ELEMENT description EMPTY >
<!ATTLIST description entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT comment EMPTY >
<!ATTLIST comment entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT resolution EMPTY >
<!ATTLIST resolution entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT attachment EMPTY >
<!ATTLIST attachment entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
attachment_content_type CDATA #REQUIRED
attachment_file_name CDATA #REQUIRED
attachment_source_url CDATA #REQUIRED
attachment_description CDATA #IMPLIED >
<!ELEMENT billing EMPTY >
<!ATTLIST billing entry CDATA #REQUIRED
date CDATA #REQUIRED
type CDATA #REQUIRED
quantity CDATA #REQUIRED
rate CDATA #REQUIRED
cost CDATA #REQUIRED
user CDATA #REQUIRED
author CDATA #REQUIRED
description CDATA #IMPLIED )
<!ELEMENT service_order_report ( service_order* ) >
I'd like to present the data in an easy-to-read format using an html file.
Any help is appreciated.
( a small example would be great!)
Thanks!
Meryl
<service_order_report>
−
<service_order project_name="ABC" service_order_number="33" author="bobw" report_to_group="dev" report_to_individual="leos" date_opened="2007-04-13 12:37:38.972" date_resolved="Unresolved" reported_by="bobw" reported_version="ABC2007" resolved_version="ABC007" resolved="false" due_date="2007-04-30" customer="N/A" total_cost="$0.00">
−
<attribute label="Company, Contact, Email, Phone">
Mispelled word in instructions on login page
</attribute>
<attribute label="Priority">Low</attribute>
<attribute label="Severity">Low</attribute>
<attribute label="Software Release">ABC2007</attribute>
<attribute label="Category">Customer-Low</attribute>
<attribute label="Build Type">Monthly</attribute>
<attribute label="Module">GUI</attribute>
<attribute label="Status">Assigned</attribute>
</service_order>
The originators of this xml provided a dtd:
<?xml version="1.0" encoding="UTF-8" ?>
<!ELEMENT service_order ( attribute*,
description*,
comment*,
resolution*,
attachment*,
billing*) >
<!ATTLIST service_order project_name CDATA #REQUIRED
service_order_number CDATA #REQUIRED
author CDATA #REQUIRED
report_to_group CDATA #REQUIRED
report_to_individual CDATA #REQUIRED
date_opened CDATA #REQUIRED
date_resolved CDATA #REQUIRED
reported_by CDATA #REQUIRED
reported_version CDATA #REQUIRED
resolved_version CDATA #REQUIRED
resolved ( true | false ) #REQUIRED
due_date CDATA #REQUIRED
customer CDATA #REQUIRED
total_cost CDATA #REQUIRED >
<!ELEMENT attribute ( #PCDATA ) >
<!ATTLIST attribute label CDATA #REQUIRED >
<!ELEMENT description EMPTY >
<!ATTLIST description entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT comment EMPTY >
<!ATTLIST comment entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT resolution EMPTY >
<!ATTLIST resolution entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
text CDATA #REQUIRED >
<!ELEMENT attachment EMPTY >
<!ATTLIST attachment entry CDATA #REQUIRED
date CDATA #REQUIRED
author CDATA #REQUIRED
attachment_content_type CDATA #REQUIRED
attachment_file_name CDATA #REQUIRED
attachment_source_url CDATA #REQUIRED
attachment_description CDATA #IMPLIED >
<!ELEMENT billing EMPTY >
<!ATTLIST billing entry CDATA #REQUIRED
date CDATA #REQUIRED
type CDATA #REQUIRED
quantity CDATA #REQUIRED
rate CDATA #REQUIRED
cost CDATA #REQUIRED
user CDATA #REQUIRED
author CDATA #REQUIRED
description CDATA #IMPLIED )
<!ELEMENT service_order_report ( service_order* ) >
I'd like to present the data in an easy-to-read format using an html file.
Any help is appreciated.
( a small example would be great!)
Thanks!
Meryl