[jdom-interest] Question about the "<" Tag
Rolf
jdom at tuis.net
Mon Mar 3 04:42:08 PST 2008
Hi Ramo
Technically, you do have the result you want...
'<' is not valid content in attribute values (or in Element text....).
See the XML specification here:
http://www.w3.org/TR/2006/REC-xml-20060816/#sec-common-syn
where it indicates:
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'"
([^<&'] | Reference)* "'"
Basically, the characters < & and " are not allowed in attribute values.
The way to get these characters is to use XML 'excapes', or nore
formally called Entity Values.
Section http://www.w3.org/TR/2006/REC-xml-20060816/#syntax of the
specification shows how to represent the characters < and & in XML with
< and & respectively.
When an XML Parser (like SAX used in JDOM) reads the document, it will
reverse the escaped values < and & to the original values < and &.
Any other escape sequences in the XML file starting with & and ending
with ; will also be replaced with the appropriate values according to
Entity value definitions too. There are many other escapes like "
and > for " and >
Rolf
Ramo At Skuff wrote:
> Hi,
>
> i try to get somethign like this:
>
> xml:
> <FormElement type="tx" character="text" id="tx_00_user" name="tx_00_user"
> tabmember="loguser" mandat="y" size="20" checkValue="isThisset" >
>
>
> To parse with this line:
>
> input.setAttribute("value", "<" + "?pho " +
> attributes.getValue("checkValue") + " (\"" + attributes.getValue("name") +
> "\"); ?>");
>
>
> to get this:
>
> <input type="text" id="tx_00_user" name="tx_00_user" class="mandatory"
> size="20" value<?php isThisset ("tx_00_user"); ?>" />
>
> But i get this:
>
> <input type="text" id="tx_00_user" name="tx_00_user" class="mandatory"
> size="20" value="<?php isThisset ("tx_00_user"); ?>" />
>
>
> Is there a way or a trick to get the result i want?
>
> Many thanks
>
> ramo
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>
>
More information about the jdom-interest
mailing list