[jdom-interest] Entity Ref
Jason Long
jason at supernovasoftware.com
Sat Feb 22 11:07:22 PST 2003
Elliotte,
Thank you very much for your timely reply.
Here is my procedure:
1. Client uploads csv generated from legacy system.
2. I convert the file to xml and then use jdom to group fields with like
terms, sum one of the columns, ect.
My problem is that one for the columns needs to be expanded so that it will
display properly when converted with XSL to HTML.
legacy generated csv line:
3.500,9.30,"P-110","8-RD EUE","MAHA","HOUSTON","IN STOCK",660.00
jdom generated line:
<item id="0" size="3.500" weight="9.30" grade="P-110" endFin="8-RD EUE"
mill="MAHA" location="HOUSTON" status="IN STOCK" footage="660.0"
price="1.00" />
The solution that I would like to implement is as follows:
If I add a dtd as follows and modify the mill attribute to be an entity,
&MAHA;:
<!ENTITY MAHA "New API Seamless Maharashtra">
The xml parser expands this to:
<item id="0" size="3.500" weight="9.30" grade="P-110" endFin="8-RD EUE"
mill="New API Seamless Maharashtra" location="HOUSTON" status="IN STOCK"
footage="660.0" price="1.00" />
This is why I would like my jdom generated file to read as:
<item id="0" size="3.500" weight="9.30" grade="P-110" endFin="8-RD EUE"
mill="&MAHA;" location="HOUSTON" status="IN STOCK" footage="660.0"
price="1.00" />
I apologize if I am missing something. It is just that it works fine if I
manually add the entities to an xml file and read from the data from there.
I just wish I could do this programmatically using JDOM. I would appreciate
any suggestions.
Thank you in advance,
Jason Long - CEO and Chief Software Engineer
Supernova Software - supernovasoftware.com
BS Physics, MS Chemical Engineering
-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Elliotte Rusty Harold
Sent: Saturday, February 22, 2003 11:54 AM
To: Jason Long; JDOM
Subject: RE: [jdom-interest] Entity Ref
At 11:23 AM -0600 2/22/03, Jason Long wrote:
>Elliotte,
>
>I have a csv file that is generated from a legacy system that I am
>converting to xml and then applying XSL to generate several views. In the
>clients system some of the columns are abbreviated. I figured that the
>easiest way was to just turn the abbreviation into an entity, add an
>external reference to a dtd which the client can edit if more abbreviations
>are added. It works just as expected if I manually add in the entities,
but
>I need to add these in at the time of conversion. Is there a way to do
this
>by applying XSL to the document?
>
Not really. You're confusing the lexical and syntactic layers of XML.
XSLT won't act any differently whether the text is output with an
entity reference or something else. I still don't quite follow what
you're doing, but it sounds like you need to adjust your design a
little so that you neither know or care whether it's the entity
reference or the actual text when processing.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list