dtd

DTD required elements ordering

半世苍凉 提交于 2019-11-29 05:59:17
I want to have list of required elements in any order defined in dtd, but have no idea how I could do this. For example, I have following definition: <!ELEMENT parent (child1, child2, child3)> This dtd declaration will successfully validate following piece of xml: <parent> <child1></child1> <child2></child2> <child3></child3> </parent> But in following case xml will not pass validation: <parent> <child2></child2> <child1></child1> <child3></child3> </parent> One of the possible solution is to declare <!ELEMENT parent (child1 | child2 | child3)> But in this case one of the childs might be

Generate Java classes with JAXB from a DTD file - how can I modify the DTD?

一世执手 提交于 2019-11-29 04:45:25
I want to generate Java classes from a dtd file using JAXB. The dtd looks like this: <!--Contents--> <!ELEMENT persons (header, content) > <!ELEMENT groups (header, content) > <!--Header--> <!ELEMENT header (version) > <!ELEMENT version(#PCDATA) > <!--Content--> <!ELEMENT content(person, group)* > <!--Person--> <!ELEMENT person(p_id, p_name) > <!ELEMENT p_id (#PCDATA) > <!ELEMENT p_name (#PCDATA) > <!--Group--> <!ELEMENT group(g_id) > <!ELEMENT g_id(#PCDATA) > When generating the classes with JAXB I get the following ones: ObjectFactory Content Person Persons Group Groups In the Content class

DTD download error while parsing XHTML document in XOM

柔情痞子 提交于 2019-11-29 04:33:13
I am trying to parse an HTML document with the doctype declared to use the transitional dtd as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> When I do Builder.build on the document, I get the following exception: java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1305) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at

XML validation against given DTD in PHP

妖精的绣舞 提交于 2019-11-29 03:01:17
问题 In PHP, I am trying to validate an XML document using a DTD specified by my application - not by the externally fetched XML document. The validate method in the DOMDocument class seems to only validate using the DTD specified by the XML document itself, so this will not work. Can this be done, and how, or do I have to translate my DTD to an XML schema so I can use the schemaValidate method? (this seems to have been asked in Validate XML using a custom DTD in PHP but without correct answer,

schema validation with msxml in delphi

我是研究僧i 提交于 2019-11-28 19:54:30
I'm trying to validate an XML file against the schemas it references. (Using Delphi and MSXML2_TLB.) The (relevant part of the) code looks something like this: procedure TfrmMain.ValidateXMLFile; var xml: IXMLDOMDocument2; err: IXMLDOMParseError; schemas: IXMLDOMSchemaCollection; begin xml := ComsDOMDocument.Create; if xml.load('Data/file.xml') then begin schemas := xml.namespaces; if schemas.length > 0 then begin xml.schemas := schemas; err := xml.validate; end; end; end; This has the result that cache is loaded ( schemas.length > 0 ), but then the next assignment raises an exception: "only

InDesign CS5 Script: How can I ignore the DTD when importing XML?

佐手、 提交于 2019-11-28 12:18:51
问题 I am importing XML into InDesign, and I get this message: The external entity 'blahblah.dtd' cannot be found. Continue to import anyway? And when I then continue to import the XML, I get this error message: Javascript Error! Error Number: 103237 Error String: DOM transformation error: Invalid namespace. Engine: session File: C:\blahblah\blahblah.jsx Line: 259 Source: obj.doc.importXML(File(xmlDoc) ); ...the problem is, is that I won't have access to the DTD, and I won't need it for my

How to add XSD datatype restrictions to a DTD?

馋奶兔 提交于 2019-11-28 11:27:50
问题 I am trying to make a DTD in which I want to add some restrictions like: Only allow the introduction of telephone numbers with 9 numbers Only allow the introduction of an ID with 7 numbers and 1 letter But I don't know how I can do that. (I know it is easier to add these restrictions with a XML Schema, but I want to do it with a DTD). 回答1: DTDs cannot restrict data to numeric types , let alone limit the number of digits: Elements : DTDs define the content spec of an element as [46]

Trying to use <!ENTITY in ANDROID resources with error: “The entity was referenced, but not declared.”

时光总嘲笑我的痴心妄想 提交于 2019-11-28 09:03:54
I'm following this solution to use enetities in my string resource file: Is it possible to do string substitution in Android resource XML files directly? I'm using an external file in the resource tree: /res/raw/entities.dtd , its content: <!ENTITY ent_devicename "MyDeviceName"> In the string.xml resource file: <!DOCTYPE resources [ <!ENTITY % ent_devicename SYSTEM "../raw/entities.dtd"> %ent_devicename; ]> <resources> <string name="name">The name is &ent_devicename;</string> </resources> but I get this error: The entity "ent_devicename" was referenced, but not declared. As you can see Android

What is DTD exactly?

♀尐吖头ヾ 提交于 2019-11-28 08:19:44
问题 I have used DTD several times in my document, but I never knew its significance. I have also tried to understand W3Schools tutorial of DTD. But I found it too theoretical. What is the significance of DTD exactly, and why are type definitions are so important? 回答1: Think of it as being a bit like a schema for a database - we're used to the idea that in normal relational databases you can only use columns which have already been declared, and you have to insert the right kind of data in them.

What is the meaning of DOCTYPE in xml file?

谁说胖子不能爱 提交于 2019-11-28 08:02:55
问题 In hibernate we use configuration and mapping xml files. In xml the first line will be version and then we specify DOCTYPE DTD line. Example: <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> Can anybody please explain what is the meaning of this? I know that DTD is document type definition which is like defining grammar for the xml. I want to know the attributes in this statement. 回答1: The line you