xml-entities

DOMDocument::load(): Namespace default prefix was not found in Entity

倾然丶 夕夏残阳落幕 提交于 2020-05-17 07:08:05
问题 I am parsing some XML with PHP DOMDocument. This is my code: $doc = new DOMDocument; $doc->resolveExternals = true; $doc->substituteEntities = true; $doc->load('../poems_xml/'.$pid.'.xml'); $xsl = new DOMDocument; $xsl->load('../xslt/title.xsl'); $proc = new XSLTProcessor; $proc->importStylesheet($xsl); $ptitle = $proc->transformToXML($doc); I have an entity file declared at the beginning of my .xml: <?xml version="1.0" encoding="utf-8"?> <?oxygen RNGSchema="../dtd/dps.rng" type="xml"?> <?xml

Converting escaped XML entities back into UTF-8

倾然丶 夕夏残阳落幕 提交于 2019-12-21 05:14:18
问题 So I've got this UTF-8 string in an XML file: Horrible place. ☠☠☠ And when I feed it to an external application, the funny characters come back escaped as XML entities: Horrible place. ☠☠☠ In Ruby, how do I convert that string back to UTF-8? There's probably a really easy solution for this, but I'm unable to find anything in the standard libraries; eg. CGI.unescapeHTML (which work nicely for things like > ) seem to ignore them completely. ree-1.8.7-2010.02 > CGI.unescapeHTML('>') => ">" ree-1

Handling US-ASCII encoded XML with unsupported entity reference

依然范特西╮ 提交于 2019-12-12 03:08:54
问题 This question is the continuation of this page PROCESS: The process involved, Opening XML file and do some modification in specific nodes and save it back to another location. PROBLEM FACING: While Saving after some modifications in XML, unsupported entity references like ö converted into ö . I want to retain the entity as it is in the source ( ö ) As ö and ö are same character but i need to retain as it is in source xml. XML SOURCE <?xml version="1.0" encoding="US-ASCII"?> <heads> <head type

Why is XmlParser converting my character hex code string to unicode?

試著忘記壹切 提交于 2019-12-11 19:29:07
问题 In my Grails application I use Groovy's XmlParser to parse an XML file. The value of one of the attributes in my XML file is a string that equals a character hex code. I want to save that string in my database: Ñ Unfortunately the attribute method returns the Ñ character and what actually gets stored in the database is c391 . When the field is read back out I also get the Ñ character which is undesired. How can I store the hex code as a string in my database and make sure it gets read back

Don't understand the output in XML Entities and PHP SimpleXMLElement

。_饼干妹妹 提交于 2019-11-28 12:35:14
问题 I use entities in XML and I don't understand my results. I have an XML file wich calls an external entity, this is config.xml : <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE config [ <!ENTITY totalInstances SYSTEM "totalInstances.xml"> ]> <config> &totalInstances; </config> Here is the file totalInstances.xml : <?xml version="1.0" encoding="UTF-8" ?> <totalInstances> <nombre>45</nombre> </totalInstances> So in PHP I load the file config.xml with the help of the Class SimpleXMLElement :