Hello,

I'm pretty sure that this error is the result of User Ignorance, so any
pointers to correctly do this would be greatly appreciated.

First, some specs on my system: Linux 2.2.13, IBM JDK 1.1.18, Xerces-J
1.0

I have a small XML file I am trying to parse.  It's so small I'll give
it here:

<?xml version="1.0"?>

<!DOCTYPE dbxmlconfig [
    <!-- DTD -->
    <!ELEMENT dbxmlconfig (database+)>
    <!ELEMENT database (driver, connection, user?, password?)>
    <!ELEMENT driver (#PCDATA)>
    <!ELEMENT connection (#PCDATA)>
    <!ELEMENT user (#PCDATA)>
    <!ELEMENT password (#PCDATA)>
    <!ATTLIST database id CDATA #REQUIRED>
]>

<!-- the dbxml config file -->

<dbxmlconfig>

<database id="mysql-bigbird">
    <!-- make sure this is in your classpath! -->
    <driver>org.gjt.mm.mysql.Driver</driver>
    <connection>
        jdbc:mysql://localhost/blah?user=blah&amp;password=blah
    </connection>
</database>

</dbxmlconfig>

As you can see, the <connection> tag has a string that includes an
'&amp;' entity.  It's my understanding that this should be converted to
a '&' when parsed.  When I print out the document using simple DOM
traversing, the '&amp;' is pulled out and nothing is put in its place.

How do I tell Xerces-J to replace '&amp;' with &?  Isn't &amp; an
internal entity?  Also, if I just include & into the <connection> tag's
contents, then the parser complains that I don't have a ';' after
password (it's thinking that password becomes an entity).

I've looked all over to try to find out how to get the & to show up.  I
might have missed it.  If anyone can shed light on this for me, I'd be
really grateful.  I'll keep looking.

Thanks for your time and help,
Seth

Reply via email to