• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Xerces question

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am parsing an XML document using Xerces parser.
Basicly, I am just following the instructions from the book <b>Java and XML</b> by McLaughlin. When I ran my program, it didn't give me the PIs and DTDs.
COuld anybody give an answer to it? By the way, I was using DOM...
[This message has been edited by Edy Yu (edited April 13, 2001).]
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is your XML?? Can you post it here??
 
Edy Yu
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is my XML.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="addressbook.xsl"?>
<!DOCTYPE addressbook [
<!ELEMENT addressbook (address)+>
<!ELEMENT address (name, street, city, state, zip)>
<!ELEMENT name (firstname, lastname)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip (#PCDATA)>
]>
<addressbook>
<address>
<name>
<firstname>Xiang</firstname>
<lastname>Yu</lastname>
</name>
<street>125 Detzel Place</street>
<city>Cincinnati</city>
<state>OH</state>
<zip>45219</zip>
</address>

<address>
<name>
<firstname>Xiaoming</firstname>
<lastname>Zou</lastname>
</name>
<street>125 Detzel Place</street>
<city>Cincinnati</city>
<state>OH</state>
<zip>45219</zip>
</address>
</addressbook>
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm..I think you're doing something wrong.
I used the SAXWriter ( sample program that comes with Apache's Xerces ) to parse your XML file and it did print out everything as expected -

Perhaps your implementation of ContentHandler is bugged. Check again.


------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
What are you doing in my house? Get 'em tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic