473,804 Members | 3,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2118
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.netwro te:
>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
--
"Considerat ion 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.netwro te:
>>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.c om/">
<!ENTITY stuff SYSTEM "myletter.d oc" 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.individua l.net>,
Peter Flynn <re*********@m. from.email.addr esswrote:
>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
--
"Considerat ion 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
4257
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" /> <xsl:template match="@*|node()">
3
1753
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 to provide customized entity processing for which I have implemented the startEntity function of the LexicalHandler interface. The problem that I am facing is with respect to any entity other than the 5 builtin ones. If any entity for example...
5
3463
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 clear. But how should parser react for such situation: I have CORDSYS element with string attribute which consists of value with many &quot; entities:
10
42971
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, the XML specification seems a little ambiguous on this, so I defer to the XML authorities. Refer to sections 2.4 and 2.7 (it all hinges on if CDATA attribute values are part of markup or not.) Thanks.
1
2042
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
2983
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 xmlns present is because the Xml I am passing to CRM is a node from a bigger file that does require a xmlns and using the DOM ..OuterXml seems to set the xmlns for you automatically - which I don't want. Any help would be great.
8
2278
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, so the validation of the document fails. Is there a recommanded solution to this situation ? I have no idea how to handle the problem: I don't want to take into account at the vocabulary level a question of syntax (the external entities) by...
1
1318
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 looking for is a structural answer, not exact source code. I have a document that has several collections at the same level. The two that concern me are entities and numeric snapshots. That is, the document contains a set of entities, each of which...
5
2663
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 here And this came out, via prettify: <addresssnippet siteurl="http%3A//apartmentsapart.com" url="http%3A//www.apartmentsapart.com/Europe/Spain/Madrid/FAQ"> <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer
0
10558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9130
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.