dtd

Special Characters in XML

痞子三分冷 提交于 2019-12-06 18:49:21
问题 I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using » and I get th error. reason: Reference to undefined entity 'raquo'. error code: -1072898046 How do I make this work? 回答1: You are trying to use an HTML entity in a non-HTML or non-XHTML document. These entities are declared in the document's Document Type Definition (DTD). You should use the numerical Unicode version of the

The new RefSeq release from NCBI is compatible with Bio.Entrez.Parser?

…衆ロ難τιáo~ 提交于 2019-12-06 14:28:37
I'm new with python and especially with Biopython. I'm trying to take some information from an XML file with Entrez.efetch and then read it. Last week this script worked well: handle = Entrez.efetch(db="Protein", id="YP_008872780.1", retmode="xml") records = Entrez.read(handle) But now I'm getting an Error: > Bio.Entrez.Parser.ValidationError: Failed to find tag 'GBSeq_xrefs' in the DTD. To skip all tags that are not represented in the DTD, please call Bio.Entrez.read or Bio.Entrez.parse with validate=False. So I run this: records = Entrez.read(handle, validate=False) But I'm still getting an

XML: How to load the contents of one xml file into another

你说的曾经没有我的故事 提交于 2019-12-06 11:54:08
I would just like to be able to dynamically write the contents of an xml file from another xml file. A.XML contains: <?xml version="1.0"?> <node> -Include Contents of b.xml </node> B.XML contains: <anode> a </anode> is there any way to do this in xml? End product looks like this: <?xml version="1.0"?> <node> <anode> a </anode> </node> Update from comments : In xml alone. so that when i view the xml file in a browser it renders correctly Use an external (parsed) general entity to reference b.xml from a.xml . <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE node [ <!ENTITY b SYSTEM "b.xml"> ]>

Check for malicious XML before allowing DTD loading?

坚强是说给别人听的谎言 提交于 2019-12-06 11:09:09
Since libxml 2.9, loading external entities has been disabled when parsing XML, to prevent XXE attacks . In that case, to be able to load a DTD file when parsing the XML with PHP's DOMDocument, LIBXML_DTDLOAD must be specified. What would be a good way to verify that only the expected DTD will be loaded, before enabling LIBXML_DTDLOAD ? One approach I can think of (as shown in the example code below) would be to keep entity loading disabled, parse the XML file once, check that the DOCTYPE declaration is as expected, then parse the XML again with entity loading enabled. Would that be sufficient

Why use both XSD and DTD for XML?

别来无恙 提交于 2019-12-06 09:03:50
问题 Stackoverflow has a couple of great questions contrasting XSD and DTD and choosing between XSD and DTD. But I came across a data format and library that used both XSD and DTD. The XML documents specify the DTD but the supporting library requires the XSD to encode and decode. What are the benefits of using an XSD and DTD at the same time? 回答1: The most significant time I've seen both DTD and XSD used together relates to the example you cite: A sector standards group had defined their XML

The markup declarations contained or pointed to by the document type declaration must be well-formed

懵懂的女人 提交于 2019-12-06 07:13:43
问题 I have this xml document: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE catalog SYSTEM "plantdtd.dtd"> <catalog> <title>Flowers of the week</title> <plant id="A1"> <name>Aloe vera</name> <climate>tropical</climate> <height>60-100cm</height> <usage>medicinal</usage> <image>aloevera.jpg</image> </plant> <plant id="A2"> <name>Orchidaceae</name> <height>8-12in</height> <usage>medicinal</usage> <usage>decoration</usage> <image>Orchidaceae.jpg</image> </plant> </catalog> I wrote a DTD like this:

Local XML validation with DTD or XSD using a relative path?

我怕爱的太早我们不能终老 提交于 2019-12-06 06:18:35
问题 An XML file can be defined and validated with an Document Type Description (DTD) or XML Schema (xsd) as follows: <?xml version='1.0' encoding='UTF-8'?> <annotation xmlns="http://www.xyz.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com file:system.xsd" > or <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE annotation SYSTEM "http://www.xyz.de/system.dtd"> Both ways define a URL where the DTD or XSD is found. Is there a way to give a relative or

Parsing XHTML with DTD using XDocument

≯℡__Kan透↙ 提交于 2019-12-06 06:16:33
I need to get plain text from XHTML documents. I am sure I already read somewhere here, that XDocument on WP7 does not support DTD. I cannot find it though. Well, when I try to parse XHTML with DTD using XDocument, it throws NotSuportedException. Last call in stacktrace is at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl() . That is exactly same even if I try to use some dummy XmlResolver - it doesn't really get called. (following answer in this question ). So I assume that WP7 really doesn't support it. Well, I need to parse XHTML docs. So far I came up with two (more or less real) solutions:

Validate xml via dtd, different directory for dtd

好久不见. 提交于 2019-12-06 05:02:42
问题 I am trying to validate an xml file via a .dtd. I have write this validator: public bool Validation(XmlDocument xmlDoc) { var xml = XmldocToString(xmlDoc); var r = new XmlTextReader(new StringReader(xml)); var settings = new XmlReaderSettings(); var sb = new StringBuilder(); settings.ProhibitDtd = false; settings.ValidationType = ValidationType.DTD; settings.ValidationEventHandler += (a, e) => { sb.AppendLine(e.Message); _isValid = false; }; XmlReader validator = XmlReader.Create(r, settings)

xmltask confused about dtd

本秂侑毒 提交于 2019-12-06 04:37:34
问题 I'm trying to use xmltask for ant to modify a file in a subdirectory: project/path/to/file.xml The file refers to a DTD like this: <!DOCTYPE data SYSTEM "mydtd.dtd"> I don't have the flexibility to change these documents. This DTD is stored in the same subdirectory, which has always worked fine: project/path/to/mydtd.dtd Unfortunately, xmltask is trying to locate the dtd in my project's top-level directory, which is where my build file is located, and where I run from: [xmltask] java.io