Changes

Jump to navigation Jump to search
390 bytes added ,  13:37, 5 March 2019
no edit summary
This article is part of the [[Advanced User's Guide]].It clarifies how to deal with external DTD declarationswhen parsing and transforming XML data.
==OverviewIntroduction==
XML documents often rely on Document Type Definitions (DTDs). While parsing a document with BaseX, entities can be resolved with respect to that particular DTD. By default, the DTD is only used for entity resolution.
Fetching <code>xhtml1-strict.dtd</code> obviously involves network traffic. When dealing with single files, this may seem tolerable, but importing large collections benefits from caching these resources. Depending on the remote server, you will experience significant speed improvements when caching DTDs locally.
== XML Entity and URI Resolvers Usage==
BaseX relies on the Apache-maintained [http://xml.apache.org/commons XML Commons Resolver]. The {{Code|xml-resolver-1.2.jar}} library is included in the full distributions of BaseX. If the resolver is not found in the classpath, and if Java 8 is used, Java’s built-in resolver will be applied (via <code>com.sun.org.apache.xml.internal.resolver.*</code>).
The '''paths''' to your catalog file and the actual DTDs are either absolute or relative to the ''current working directory''. When using BaseX in Client-Server-Mode, this is relative to the ''server's'' working directory.
===Please NoteAdditional Notes===
Entity resolving only works if the [[Parsers#XML Parsers|internal XML parser]] is switched off (which is the default case).
If you use the internal parser, you can manually specify whether you want to parse DTDs and entities or not.
== More Information ==If no {{Code|CatalogManager.properties}} property file is found in the classpath, the following catalog resolver properties will be set (see [https://xerces.apache.org/xml-commons/components/resolver/resolver-article.html#ctrlresolver Controlling the Catalog Resolver] for more information):* {{Code|xml.catalog.ignoreMissing}}: {{Code|true}}* {{Code|xml.catalog.staticCatalog}}: {{Code|false}}
==Links== *[http://en.wikipedia.org/wiki/Document_Type_Definition Wikipedia on Document Type Definitions]*[http://xml.apache.org/commons/components/resolver/resolver-article.html Apache XML Commons Article on Entity Resolving]*[http://java.sun.com/webservices/docs/1.6/jaxb/catalog.html XML Entity and URI Resolvers], Sun*[http://www.oasis-open.org/committees/download.php/14810/xml-catalogs.pdf XML Catalogs. OASIS Standard, Version 1.1. 07-October-2005.]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu