DTD parsing errors

12 views
Skip to first unread message

kirill dorofeyev

unread,
Dec 30, 2019, 11:49:13 AM12/30/19
to FBDK
Hi, i have found two issues while trying to parse 4diac FB files:

1. Java DOM refuses to parse 4diac FBs xml files, throwing out “The markup declarations contained or pointed to by the document type declaration must be well-formed”. It looks like the problem is that http://www.holobloc.com/xml/LibraryElement.dtd file has <?xml version="1.0" encoding="UTF-8"?>  at its start, which it must not as, f.ex., stated here [1]. After I edit dtd locally, DOM is happy again. 
2. The same LibraryElement.dtd file contains the following definition of a FBTypeElement

<!ELEMENT FBType (Identification?,VersionInfo+,CompilerInfo?,InterfaceList,  (BasicFB | FBNetwork)?, Service?) > 
<!ATTLIST FBType
  Name CDATA #REQUIRED
  Comment CDATA #IMPLIED >
<!ELEMENT InterfaceList (EventInputs?,EventOutputs?,InputVars?,OutputVars?,  Sockets?, Plugs?)> 
<!ELEMENT EventInputs (Event+)> 
<!ELEMENT EventOutputs (Event+)> 
<!ELEMENT InputVars (VarDeclaration+)> 
<!ELEMENT OutputVars (VarDeclaration+)> 
<!ELEMENT Sockets (AdapterDeclaration+)> 
<!ELEMENT Plugs (AdapterDeclaration+)>

Should not all VarDeclarations and AdapterDeclarations have * instead of +? It'd be a valid FB for me.

James Christensen

unread,
Dec 30, 2019, 3:07:16 PM12/30/19
to FBDK
1. The problem may be that LibraryElement.dtd is now on a secure server, which will automatically convert HTTP requests to HTTPS responses, i.e., http://www.holobloc.com/xml/LibraryElement.dtd returns https://www.holobloc.com/xml/LibraryElement.dtd. This may be a problem with 4DIAC XML files, but is not a problem with FBDK XML files, which have all been updated to the secure server. Or perhaps the Java DOM parser (javax.xml.parsers.DocumentBuilder?) dislikes HTTP transfer. BTW, your reference does not say that the <?xml version="1.0" encoding="UTF-8"?> header is forbidden, just that the inquirer had misspelled "apache".
2. The case of zero elements in a sublist of InterfaceList is covered by the syntax that all sublists are optional, e.g., "EventInputs?" means zero or one "EventInputs" list.
--
Best regards,
Jim Christensen


--
You received this message because you are subscribed to the Google Groups "FBDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fbdk+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fbdk/d398bb56-f344-4206-99c8-b957ca1e98a0%40googlegroups.com.

kirill dorofeyev

unread,
Dec 30, 2019, 3:43:58 PM12/30/19
to FBDK
Hi Jim,

thanks for the feedback.

1. the answer on stackoverflow says there are two issues -- first, misspelled apache, and, second, "The DTD available at http://struts.apache.org/dtds/struts-2.0.dtd starts with an XML declaration (<?xml version="1.0" encoding="UTF-8"?>), which is forbidden at the beginning of a DTD (because a DTD is not an XML file)."
Java gets the file correctly: I reproduce the same behavior when i download LibraryElement.dpd and run it locally. When I delete the <?xml version="1.0" encoding="UTF-8"?>, it works like a charm.
2. Makes sense. I'll re-check why I'm getting an error there.

Best regards,
Kirill
To unsubscribe from this group and stop receiving emails from it, send an email to fb...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages