473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Attribute value and blank entity

Max
Hello!

I would want to know if attributes values can be entity references and
if the parser, during processing, can replace with blank string a non
registered entity.

Eg:
<example val="&entity1;&entity2;"></example>

&entity1; is a registered internal/external general entity
&entity1; has replacement text = "value"

&entity2; is a non registered internal/external general entity

Results:
<example val="value"></example>

Thanks,

Max
Mar 4 '07 #1
9 2089
Max wrote:
I would want to know if attributes values can be entity references
Yes, as long as the entity value is syntactically valid to be an
attribute value.
if the parser, during processing, can replace with blank string a non
registered entity.
An undefined entity is an error.
http://www.w3.org/TR/2006/REC-xml11-...wf-entdeclared
http://www.w3.org/TR/2006/REC-xml11-...vc-entdeclared

If you need a replacement mechanism that can support defaults, entity
references aren't it. I'd suggest investigating something like XSLT,
possibly using the Literal Result Element As Stylesheet spproach so your
source document is invoked as the stylesheet and AVTs which reference a
values file via document() are used to fill in the gap.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 4 '07 #2
In article <Ts******************************@comcast.com>,
Joe Kesselman <ke************@comcast.netwrote:
>I would want to know if attributes values can be entity references
>Yes, as long as the entity value is syntactically valid to be an
attribute value.
Attribute values can't contain references to external entities, only
internal ones.

http://www.w3.org/TR/REC-xml/#NoExternalRefsa

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Mar 5 '07 #3
Max
Joe Kesselman ha scritto:
An undefined entity is an error.
Thanks Kesselman!

what type of error is it generated?

Max
Mar 5 '07 #4
Max wrote:
what type of error is it generated?
Check the documentation for the parser you're using.
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 5 '07 #5
Richard Tobin wrote:
In article <Ts******************************@comcast.com>,
Joe Kesselman <ke************@comcast.netwrote:
>>I would want to know if attributes values can be entity references
>Yes, as long as the entity value is syntactically valid to be an
attribute value.

Attribute values can't contain references to external entities, only
internal ones.

http://www.w3.org/TR/REC-xml/#NoExternalRefsa
The spec is misleading. AFAIK only XML external entity references are
forbidden in attribute values. Data external entities should be OK, eg

<?xml version="1.0"?>
<!DOCTYPE foo [
<!ELEMENT foo EMPTY>
<!ATTLIST foo bar ENTITY #REQUIRED>
<!NOTATION doc SYSTEM "http://www.microsoft.com/">
<!ENTITY stuff SYSTEM "myletter.doc" NDATA doc>
]>
<foo bar="stuff"/>

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Mar 5 '07 #6
For an explanation of what that rule means, from one of the folks who
defined it, see Tim Bray's _Annotated_XML_Specification_. One copy can
be found at

http://www.xml.com/axml/testaxml.htm

If you scroll or search down to "Well-Formedness Constraint: No External
Entity References", then click on the "(T)" icon following that
sentence, the second window will bring up the justification for why it
really does mean exactly what it says.
The Annotated XML Spec, by the way, is an absolutely invaluable resource
if you're trying to figure out what the spec really means, or why it is
as it is, or if you just want to better understand the philosophy behind
the original design of XML. Highly recommended resource. The only
complaint anyone has been able to make is that it's specifically based
on XML 1.0... and Tim Bray has said that he simply doesn't have the time
and energy to tackle updating it for XML 1.1.
By the way, when reading W3C specs, don't forget to check the errata
documents too. Sometimes there is newer information there, and often the
history of how the document has been clarified is enlightening... at
least for us language lawyers. (Reading specs is a skill worth
acquiring, by the way.)

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 6 '07 #7
In article <55*************@mid.individual.net>,
Peter Flynn <re*********@m.from.email.addresswrote:
>Attribute values can't contain references to external entities, only
internal ones.
> http://www.w3.org/TR/REC-xml/#NoExternalRefsa
>The spec is misleading. AFAIK only XML external entity references are
forbidden in attribute values. Data external entities should be OK, eg
You're using SGML terminology I think. XML has parsed and unparsed
entities. Only entity references that are to parsed internal entities
can occur in attribute values. The names of unparsed entities can
appear *as* entity values: as your example shows, they don't use the
&name; syntax. The term "entity reference" is not used for unparsed
entities in the XML spec, see

http://www.w3.org/TR/REC-xml/#textent

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Mar 6 '07 #8
Max
Joseph Kesselman ha scritto:
Check the documentation for the parser you're using.
Ehm... i'm programming my xml parser with javascript... What type of
error you think i have to generate?

Max
Mar 6 '07 #9
Max wrote:
Ehm... i'm programming my xml parser with javascript... What type of
error you think i have to generate?
If you're writing your parser to conform to one of the standard parser
APIs (SAX/JAXP), those specify how errors are presented. If you're doing
it from scratch, it's up to you to define it and document it... though
I'd suggest you look at those (and at the DOM errors) for examples of
how people have reported these in the past.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Christian Roth | last post by:
Hello, when using this "identity" processing sheet: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="iso-8859-1" /> ...
3
by: Vineeth | last post by:
Hi, I am developing an application using the SAX interface provided by "xerces-j 2.6.0". My application does not need a DTD for execution as it is not supposed to perform any validation. I have...
5
by: Mateusz Loskot | last post by:
Hi, I'd like to ask how XML parsers should handle attributes which consists of &quot; entity as value. I know XML allows to use both: single and double quotes as attribute value terminator. That's...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
1
by: arnold | last post by:
Hi, I've been knocking my head against the wall trying to create an XSL transform to perform "normalizations" of a set of XML files that have a common structure. % XML file before transform
7
by: Simon Hart | last post by:
Hi, I have a requirement to remove the xmlns from the DOM in order to pass over to MS CRM 3.0 Fetch method.It seems the fetch method blows up if there is a xmlns present!?! The reason I have a...
8
by: SL | last post by:
I try to validate against a schema a document stored in several files thanks to external entities. The parseur add a 'xml:base="url"' attribute on the root element of this sub-trees during parsing,...
1
by: C Wilson | last post by:
I may need to resort to some other tool but right now I'm limiting myself to XPath and XSLT and suchlike. I'm an XPath newbie. I'm framing my question as a structural one and what I think I'm...
5
by: John Nagle | last post by:
This, which is from a real web site, went into BeautifulSoup: <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!&blinkt=Click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.