dtd

How to generate xml file with an existing dtd for sample of data using Java

旧城冷巷雨未停 提交于 2021-02-11 12:29:36
问题 I have some data stored in : HashMap<Position, Double> listOfPoints = new HashMap<>(); Where key contains pair (x,y). I have defined also my dtd file called generated.dtd which contains my structure : <!ELEMENT table (point*,id,position,x,y,value)> <!ELEMENT point (id,position,value)> <!ELEMENT id (ID)> <!ELEMENT position (x,y)> <!ELEMENT value (#PCDATA)> <!ELEMENT x (#PCDATA)> <!ELEMENT y (#PCDATA)> Using that file and sample of data stored in listOfPoints , I would like to generate an xml

cvc-elt.1: Cannot find the declaration of element 'data'

主宰稳场 提交于 2021-02-08 03:42:26
问题 These are my simple XSD and XML files, I keep getting cvc-elt.1 for the "data" node. Here is the XML <?xml version="1.0" encoding="UTF-8" ?> <data xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.w3schools.com/xml {FULL_PATH}/car_designer.xsd"> <car_designer id="1" designer_name="A C Bertelli"/> <car_designer id="2" designer_name="Adam Ty Dean Smith"/> </data> Here is the XSD <?xml version="1.0" encoding="UTF-8"?> <xs

Can XML attributes have spaces?

老子叫甜甜 提交于 2021-02-07 12:10:33
问题 I'm creating a DTD for an xml document. I have an Enumerated attribute for an xml element. My question is: Can the attribute Type have spaces? eg: <!ELEMENT Link (#PCDATA)> <!ATTLIST Link Type (Amendment|Reference|Superseded|Modified| Corrigendum|Corresponds|Endorsement|Equivalent|Identical|Modified| Not Equivalent|Note taken of|Related|Similar) "Reference"> So what I would like is: <Link Type="Not Equivalent" \> But that seems to barf. Is there some magic voodoo I need to do for spaces? Or

Can XML attributes have spaces?

时间秒杀一切 提交于 2021-02-07 12:07:28
问题 I'm creating a DTD for an xml document. I have an Enumerated attribute for an xml element. My question is: Can the attribute Type have spaces? eg: <!ELEMENT Link (#PCDATA)> <!ATTLIST Link Type (Amendment|Reference|Superseded|Modified| Corrigendum|Corresponds|Endorsement|Equivalent|Identical|Modified| Not Equivalent|Note taken of|Related|Similar) "Reference"> So what I would like is: <Link Type="Not Equivalent" \> But that seems to barf. Is there some magic voodoo I need to do for spaces? Or

Can we put regular expression for a value in a DTD?

拥有回忆 提交于 2021-01-27 17:52:18
问题 I would like to know if there is a way to associate regular expression for the value of an attribute. like in XML Schema: <xs:pattern value="([0-9]|[A-Z]){3}" /> to make the DTD match with this XML line: <airport iata="LAE" name="Nadzab Airport" city="Nadzab" country="Papua New Guinea"> 回答1: No, DTDs do not support regex. Use XSD for vastly superior datatyping. DTD attribute values can be enumerations, however: <!ELEMENT airport EMPTY> <!ATTLIST airport iata (LAE|LAX|LGA) #IMPLIED> 来源: https:

Using DTD can I specify an exact number of element occurrences?

筅森魡賤 提交于 2020-05-23 23:52:12
问题 I am trying to do this exercise in XML and I am stuck at this particular point. I am being asked to create a DTD that will satisfy a list of requirements and I cannot find a way to achieve the following: The seasonal_prices' list can have none, one, two or three occurrences of the 'season_price' element Is there a way to achieve this using only a DTD? 回答1: Is there a way to achieve this using only a DTD? Nope. You can only do: season_price (exactly one) season_price? (zero or one) season

Using DTD can I specify an exact number of element occurrences?

雨燕双飞 提交于 2020-04-30 09:26:51
问题 I am trying to do this exercise in XML and I am stuck at this particular point. I am being asked to create a DTD that will satisfy a list of requirements and I cannot find a way to achieve the following: The seasonal_prices' list can have none, one, two or three occurrences of the 'season_price' element Is there a way to achieve this using only a DTD? 回答1: Is there a way to achieve this using only a DTD? Nope. You can only do: season_price (exactly one) season_price? (zero or one) season