Question about the "<" Tag

View: New views
3 Messages — Rating Filter:   Alert me  

Question about the "<" Tag

by Ramo At Skuff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...

Re: Question about the "<" Tag

by Rolf Lear-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
>
>  

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@...

Re: Question about the "<" Tag

by Mattias Jiderhamn-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Another way to put it: What you are trying to produce isn't XML, so you
shouldn't be using JDOM.

 /Mattias Jiderhamn

Rolf wrote (2008-03-03 13:42):

> 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@...
LightInTheBox - Buy quality products at wholesale price