public class Dtd2Def extends Object
ResolvedModule
!!)
or null in case of error. convert(MessageReceiver,DTD.Dtd,String)
.
ModuleRegistry
, when a file (or resource)
with ".dtd" is found relevant as a text format governor, and by Main
directly when
"task==dtd2def", because error handling is slightly different.
<?tdom xmlns:p="name_space_uri" ?>
declaration. These declarations have the whole dtd (incl. all inclusions)
as their scope, and do not conflict.
xml:lang --> xml_lang or xml_0_lang or xml_1_lang etc.Currently, the "namespace" declarations on the ddf-module-level are indeed reconstructed, but they are not needed since explicit "xmlrep" modifiers are added to each constructed definition.
A different approach would generate local modules and import them again, but this would only avoid clashes of definition names, not of input tags!
=?? FIXME RAUS?? WAS SOLL DAS: Additionally, all namespace prefices which are linked to the default namespace uri are reduced to this default, ie. eliminated as a prefix.
What is done, is
There are some proposals for a more sophisticated treatment of attributes in the old d2d or java-tools version. These should be considered in future versions, because LATER we should support
('A'..'Z'|'a'..'z') ( ('a'..'z')|('A'..'Z')|('0'..'9') | '_' | '-' )* ;see file d2d2/parser/d2d.g
Modifier and Type | Class and Description |
---|---|
protected class |
Dtd2Def.Phase1 |
Modifier and Type | Field and Description |
---|---|
protected TagsRegExp |
attContainer |
protected @Opt String |
defaultNamespaceURI |
protected Map<NamespaceName,String> |
dtdname2ddfname |
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> |
msg |
protected MessageCounter<SimpleMessage<XMLDocumentIdentifier>> |
msgCounter |
protected Map<String,String> |
namespacePrefices |
protected boolean |
namespacesDeclared |
protected Module |
result |
protected TagsRegExp |
targetEl |
Constructor and Description |
---|
Dtd2Def() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkName(String s,
Location<XMLDocumentIdentifier> elloc)
Checks that not illegal characters are in the name of the ddf definition to create.
|
@Opt Module |
convert(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> p_msg,
DTD.Dtd input_dtd,
String name)
Convert one DTD.Dtd to a ddf module.
|
protected void |
makeElementNameTranslations_namespaceMode(DTM.Dtd dtd)
Make element name translation map.
|
protected void |
makeElementNameTranslations_nonNamespaceMode(DTM.Dtd dtd) |
protected void |
mapNames(NamespaceName nn,
String s,
Location<XMLDocumentIdentifier> elloc)
Maps the dtd NamespaceName to an internal element name,
after checking that not illegal characters are in the latter by calling
checkName(String, Location) . |
protected boolean |
tryMangle(NamespaceName nn,
String name,
Location<XMLDocumentIdentifier> elloc)
If the name is already used, return false.
|
protected MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg
protected MessageCounter<SimpleMessage<XMLDocumentIdentifier>> msgCounter
protected Module result
protected TagsRegExp attContainer
protected final Map<NamespaceName,String> dtdname2ddfname
protected boolean namespacesDeclared
protected TagsRegExp targetEl
@Opt public @Opt Module convert(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> p_msg, DTD.Dtd input_dtd, String name)
name
- the name for the ddf definition module to createprotected boolean checkName(String s, Location<XMLDocumentIdentifier> elloc)
('A'..'Z'|'a'..'z') ( ('a'..'z')|('A'..'Z')|('0'..'9')| '_' | '-' )*
.
"Extender" characters allowed in XML tags are detected, and colons not removed
because namespace mode has not been declared by PIs.s
- the name for the constructed ddf definitionelloc
- the location of the source element declaration, for error messages.protected void mapNames(NamespaceName nn, String s, Location<XMLDocumentIdentifier> elloc)
checkName(String, Location)
.nn
- the name as occuring in the dtds
- the name as occuring in the constructed ddfelloc
- the location of the source element declaration, for error messages.protected boolean tryMangle(NamespaceName nn, String name, Location<XMLDocumentIdentifier> elloc)
protected void makeElementNameTranslations_namespaceMode(DTM.Dtd dtd)
protected void makeElementNameTranslations_nonNamespaceMode(DTM.Dtd dtd)
see also the complete user documentation .