You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Weiler, Frank (KBV)" <FW...@KBV.DE> on 2006/07/27 11:13:07 UTC

why are > and apostroph not escaped in attributes ?

Hello from Berlin !

I just wonder, why the code of Saver.entitizeAttrValue() contains escaping for < to &lt; but not > to &gt;.
Is the use of > and apostroph restricted in attribute values ?

And next question: Has someone use sucessfull the XMLOptions.setSaveSubstituteCcharacters() -method ?

Regards ?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: why are > and apostroph not escaped in attributes ?

Posted by Wing Yew Poon <wp...@bea.com>.
Maarten,
I believe you are correct that xmlbeans 2.0.0 did not escape the '>'
in "]]>" when it's not the end of a CDATA section.
This was fixed in 2.1.0.
See http://issues.apache.org/jira/browse/XMLBEANS-192.
Frank, 
since you obviously have looked at xmlbeans src, take a look at
test/src/misc/detailed/CharEscapeTest.java.
You'll find there examples of how to use XmlOptionCharEscapeMap in
conjunction with XmlOptions.setSaveSubstituteCharacters().
- Wing Yew

-----Original Message-----
From: Radu Preotiuc-Pietro 
Sent: Thursday, July 27, 2006 10:31 AM
To: user@xmlbeans.apache.org
Subject: RE: why are > and apostroph not escaped in attributes ?

Hm, I think you mean XMLBeans is not doing the "MUST, for compatibility,
be escaped using either "&gt;" or a character reference when it appears
in the string "]]>" in content, when that string is not marking the end
of a CDATA section" part, right? But the rest is done as per spec.

Radu

-----Original Message-----
From: Maarten Bosteels [mailto:mbosteels.dns@gmail.com] 
Sent: Thursday, July 27, 2006 4:20 AM
To: user@xmlbeans.apache.org
Subject: Re: why are > and apostroph not escaped in attributes ?

>From http://www.w3.org/TR/REC-xml/
--------------------
The ampersand character (&) and the left angle bracket (<) MUST NOT
appear in their literal form, except when used as markup delimiters, or
within a comment, a processing instruction, or a CDATA section. If they
are needed elsewhere, they MUST be escaped using either numeric
character references or the strings "&amp;" and "&lt;" respectively.
The right angle bracket (>) MAY be represented using the string "&gt;",
and MUST, for compatibility, be escaped using either "&gt;" or a
character reference when it appears in the string "]]>" in content, when
that string is not marking the end of a CDATA section.

In the content of elements, character data is any string of characters
which does not contain the start-delimiter of any markup and does not
include the CDATA-section-close delimiter, "]]>". In a CDATA section,
character data is any string of characters not including the
CDATA-section-close delimiter, "]]>".

To allow attribute values to contain both single and double quotes, the
apostrophe or single-quote character (') MAY be represented as "&apos;",
and the double-quote character (") as "&quot;".
------------------

It seems that xmlbeans 2.0.0 does not escape "<"
when it appears in the string "]]>"
I haven't tested it with later versions.

Maarten

On 7/27/06, Weiler, Frank (KBV) <FW...@kbv.de> wrote:
> Hello from Berlin !
>
> I just wonder, why the code of Saver.entitizeAttrValue() contains
escaping for < to &lt; but not > to &gt;.
> Is the use of > and apostroph restricted in attribute values ?
>
> And next question: Has someone use sucessfull the
XMLOptions.setSaveSubstituteCcharacters() -method ?
>
> Regards ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: why are > and apostroph not escaped in attributes ?

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
Hm, I think you mean XMLBeans is not doing the "MUST, for compatibility,
be escaped using either "&gt;" or a character reference when it appears
in the string "]]>" in content, when that string is not marking the end
of a CDATA section" part, right? But the rest is done as per spec.

Radu

-----Original Message-----
From: Maarten Bosteels [mailto:mbosteels.dns@gmail.com] 
Sent: Thursday, July 27, 2006 4:20 AM
To: user@xmlbeans.apache.org
Subject: Re: why are > and apostroph not escaped in attributes ?

>From http://www.w3.org/TR/REC-xml/
--------------------
The ampersand character (&) and the left angle bracket (<) MUST NOT
appear in their literal form, except when used as markup delimiters, or
within a comment, a processing instruction, or a CDATA section. If they
are needed elsewhere, they MUST be escaped using either numeric
character references or the strings "&amp;" and "&lt;" respectively.
The right angle bracket (>) MAY be represented using the string "&gt;",
and MUST, for compatibility, be escaped using either "&gt;" or a
character reference when it appears in the string "]]>" in content, when
that string is not marking the end of a CDATA section.

In the content of elements, character data is any string of characters
which does not contain the start-delimiter of any markup and does not
include the CDATA-section-close delimiter, "]]>". In a CDATA section,
character data is any string of characters not including the
CDATA-section-close delimiter, "]]>".

To allow attribute values to contain both single and double quotes, the
apostrophe or single-quote character (') MAY be represented as "&apos;",
and the double-quote character (") as "&quot;".
------------------

It seems that xmlbeans 2.0.0 does not escape "<"
when it appears in the string "]]>"
I haven't tested it with later versions.

Maarten

On 7/27/06, Weiler, Frank (KBV) <FW...@kbv.de> wrote:
> Hello from Berlin !
>
> I just wonder, why the code of Saver.entitizeAttrValue() contains
escaping for < to &lt; but not > to &gt;.
> Is the use of > and apostroph restricted in attribute values ?
>
> And next question: Has someone use sucessfull the
XMLOptions.setSaveSubstituteCcharacters() -method ?
>
> Regards ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: why are > and apostroph not escaped in attributes ?

Posted by Maarten Bosteels <mb...@gmail.com>.
>From http://www.w3.org/TR/REC-xml/
--------------------
The ampersand character (&) and the left angle bracket (<) MUST NOT
appear in their literal form, except when used as markup delimiters,
or within a comment, a processing instruction, or a CDATA section. If
they are needed elsewhere, they MUST be escaped using either numeric
character references or the strings "&amp;" and "&lt;" respectively.
The right angle bracket (>) MAY be represented using the string
"&gt;", and MUST, for compatibility, be escaped using either "&gt;" or
a character reference when it appears in the string "]]>" in content,
when that string is not marking the end of a CDATA section.

In the content of elements, character data is any string of characters
which does not contain the start-delimiter of any markup and does not
include the CDATA-section-close delimiter, "]]>". In a CDATA section,
character data is any string of characters not including the
CDATA-section-close delimiter, "]]>".

To allow attribute values to contain both single and double quotes,
the apostrophe or single-quote character (') MAY be represented as
"&apos;", and the double-quote character (") as "&quot;".
------------------

It seems that xmlbeans 2.0.0 does not escape "<"
when it appears in the string "]]>"
I haven't tested it with later versions.

Maarten

On 7/27/06, Weiler, Frank (KBV) <FW...@kbv.de> wrote:
> Hello from Berlin !
>
> I just wonder, why the code of Saver.entitizeAttrValue() contains escaping for < to &lt; but not > to &gt;.
> Is the use of > and apostroph restricted in attribute values ?
>
> And next question: Has someone use sucessfull the XMLOptions.setSaveSubstituteCcharacters() -method ?
>
> Regards ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org