|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Internal entities removed from XML?
OK, a couple of us looked at this and it looks like a bug in how we handle entities used as values for namespace declarations. I can't confirm the exact details of the bug because the dev is on Christmas vacation. A co-worker is in the process filing this in our bug database. Thanks for providing the repro. -- PITHY WORDS OF WISDOM The hurrier you go, the behinder you get. This posting is provided "AS IS" with no warranties, and confers no rights. > > > -----Original Message----- > From: Doug Ransom [mailto:Doug.Ransom@p...] > Sent: Wednesday, December 18, 2002 1:16 PM > To: Xml-Dev@Lists. Xml. Org (E-mail) > > I want to be clear. I am not saying the .net platform > doesn't provide mechanisms to load XML 1.0 files that have > internal entity references; I believe the easiest mechanisms > to load xml documents, and therefore the one most developers > will employ in their code unless they have a reason not to, > will not expand entity references. Therefore, although the > .net platform supports entity references, the bulk of code > written for .net intended to parse any valid XML file for the > application will likley not support this case, because the > default case is to support only XML files with no DOCTYPE > entities. The default mechansims of loading XML in .net only > load a subset of XML 1.0 files. To load any valid XML 1.0 > document, you have to go out of your way. Its not > super-hard, but many developers are not going to realize this > and not test with documents with entity references. Their > products will tend not to fail until they hit the field. As > a result, people will be loathe to include entity references > in their documents knowing most .net programs are not > designed for XML 1.0, but a subset of XML 1.0 that exludes > entity references. > > Below is text I have pasted from an XML file which will not > load with System.Xml.XmlDocument(filename) nor with > System.Xml.Xsl.XslTransform(filename), although COM and java > based code (like saxon and msxsl) will load and process it > document fine. > > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE x:stylesheet [ > <!ENTITY xsl "http://www.w3.org/1999/XSL/Transform"> > <!ENTITY bi > "http://rddl.xmlinside.net/PowerMeasurement/data/StampLog/Archive/1/"> > <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> > <!ENTITY rss "http://purl.org/rss/1.0/"> <!ENTITY dc > "http://purl.org/dc/elements/1.1/"> > <!ENTITY syn "http://purl.org/rss/1.0/modules/syndication/"> > <!ENTITY sla "/bi:StampLogArchive"> > ]> > <!--pass in the name of the person and the uri to their file--> > > <x:stylesheet version="1.0" xmlns:x="&xsl;" xmlns:bi="&bi;" > xmlns:rdf="&rdf;" > xmlns:dc="&dc;" xmlns:syn="&syn;" > > <x:output indent="yes" encoding="UTF-8"/> <x:variable > name="owner" select="&sla;/@user"/> <x:variable > name="owner-uri" select="&sla;/@archiveHome"/> <x:template match="/"> > > <rdf:RDF xmlns="&rss;"> > <channel > > > <x:attribute name="about" namespace="&rdf;"> > <x:value-of select="$owner-uri"/> > </x:attribute> > <title>Log for <x:value-of select = "$owner" /> </title> > <link><x:value-of select="$owner-uri"/> </link> > <description><![CDATA[Power Measurement R&D > Log]]></description> > <dc:rights>(c) 2002 Power Measurement. Propietary > and Confidential.</dc:rights> > <syn:UpdatePeriod>hourly</syn:UpdatePeriod> > <syn:UpdateFrequency>1</syn:UpdateFrequency> > <syn:UpdateBase>0000-00-00T12:00+00:00</syn:UpdateBase> > > > > <items> > <rdf:Seq> > <x:apply-templates > select="/bi:StampLogArchive/bi:LogEntry/@ID" /> > </rdf:Seq> > > </items></channel> > <x:apply-templates select="bi:StampLogArchive/bi:LogEntry"/> > > </rdf:RDF> > </x:template> > <x:template name="createEntryURI"> > <x:param name="fragment"></x:param> > <x:value-of > select='concat($owner-uri,"#",string($fragment))' /> > </x:template> <x:template match="@ID" > > > <x:variable name="uri"> > <x:call-template name="createEntryURI"> > <x:with-param name="fragment" select="."/> > </x:call-template> > </x:variable> > <li xmlns="&rdf;" rdf:resource="{$uri}"/> > > </x:template> > <x:template match="bi:LogEntry" > > > <x:variable name="uri"> > <x:call-template name="createEntryURI"> > <x:with-param name="fragment" select="@ID"/> > </x:call-template> > </x:variable> > > <item xmlns="&rss;" rdf:about="{$uri}"> > > <title><x:value-of select="bi:Subject"/></title> > <link><x:value-of select="$uri"/></link> > <dc:date><x:value-of select="@updateUT"/></dc:date> > <dc:description> > <x:value-of select="bi:Content"/> > </dc:description> > <dc:subject><x:value-of > select="bi:Subject"/></dc:subject> > </item> > > </x:template> > > </x:stylesheet> > > > > > > > > -----Original Message----- > > From: Cavnar-Johnson, John [mailto:JCavnar-Johnson@s...] > > Sent: Tuesday, December 17, 2002 7:38 PM > > To: 'Xml-Dev@Lists. Xml. Org (E-mail)' > > Cc: Doug Ransom > > Subject: RE: Internal entities removed from XML? > > > > > > What are you talking about? Do you have some examples? There are > > several examples in the help files that come with the > framework that > > show how to work with XML entities (both internal and external DTD). > > These examples show using entities with XmlDocument, XmlNodeReader, > > and XmlValidatingReader. If you search the .NET help files for the > > word "entity", you will find tons of information on how to > work with > > entities in your XML files. How does this add up to "Microsoft has > > essentially removed entity references from XML"? You make > some awfully > > sweeping statements that seem to be belied by the rather extensive > > .NET help documentation on using XML entities. > > > > I would really like you to send me a copy of a well-formed XML file > > that will make my .NET xml processor "barf". > > > > -----Original Message----- > > From: Doug Ransom [mailto:Doug.Ransom@p...] > > Sent: Tuesday, December 17, 2002 8:46 PM > > To: Xml-Dev@Lists. Xml. Org (E-mail) > > Subject: Internal entities removed from XML? > > > > With the Microsoft .net (dotnet) platform, it seems one > really has to > > go out of ones way to develop code which can read an XML file with > > entity references, even internal entity references. I ran > into this > > when I tried some XSLT programs that worked successfully with saxon > > (java based xslt processor) and msxsl (COM based xslt > processor) with > > a .net based XSLT processor. > > > > The default mechanismsms (XMLReader and XMLDocument) to > load and read > > XML documents or XSLT programs simply fail when presented > with a valid > > XSLT program which is serialized in valid XML. > > > > I wonder if a whole bunch of existing XML files that work fine with > > existing applications are going to break new applications > designed to > > work with the same XML documents (i.e. a .net XSLT processor to > > replace msxsl). I suspect there are a fair number of valid XML > > documents out there that simply won't parse under .net. > > > > I think Microsoft has essentially removed entity references > from XML, > > because now document authors won't dare produce XML > documents that the > > majority of programs built on the .net platform will barf > on. Users > > will be pretty upset at an author if they receive an XML > document from > > them which won't load with their .net program. > > > > The WS-Interoperability profile also suggests entities not > be used in > > SOAP messages. It seems like there are two versions of XML > now; one > > that works with .net and WS-I, and an XML 1.0 document > with a DOCTYPE > > section that cannot be parsed by what will replace the most > commonly > > used XML Platform (as .net replaces COM on windows). > > > > Any comments? Maybe removing entity references is a good > thing (I know > > implementators of embedded system platforms think so), and mabe > > Microsoft is doing the right thing by making entity > expansion a thing > > developers have to go out of their way to make their software > > perform. > > > > > > Doug Ransom > > > > > > > > ----------------------------------------------------------------- > > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > > initiative of OASIS <http://www.oasis-open.org> > > > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > > > To subscribe or unsubscribe from this list use the subscription > > manager: <http://lists.xml.org/ob/adm.pl> > > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org > <http://www.xml.org>, an initiative of OASIS > <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> > >
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








