Renamed ElementNamespaceContext to ElementNamespace.
This commit is contained in:
parent
df1f1fb959
commit
b1193b9051
|
@ -35,13 +35,13 @@ import org.x4o.xml.eld.lang.ElementClassAttributeBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementClassBindingHandler;
|
import org.x4o.xml.eld.lang.ElementClassBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementInterfaceBindingHandler;
|
import org.x4o.xml.eld.lang.ElementInterfaceBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementModuleBindingHandler;
|
import org.x4o.xml.eld.lang.ElementModuleBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ElementNamespaceContextBindingHandler;
|
import org.x4o.xml.eld.lang.ElementNamespaceBindingHandler;
|
||||||
import org.x4o.xml.eld.lang.ModuleElement;
|
import org.x4o.xml.eld.lang.ModuleElement;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
|
|
||||||
|
@ -96,15 +96,15 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
|
||||||
addBindingHandler(languageModule,new ElementModuleBindingHandler(),"cel-module-bind","Binds the LanguageModule childeren.");
|
addBindingHandler(languageModule,new ElementModuleBindingHandler(),"cel-module-bind","Binds the LanguageModule childeren.");
|
||||||
addBindingHandler(languageModule,new ElementClassAttributeBindingHandler(),"cel-class-attr-bind","Binds the ElementClassAttribute childeren.");
|
addBindingHandler(languageModule,new ElementClassAttributeBindingHandler(),"cel-class-attr-bind","Binds the ElementClassAttribute childeren.");
|
||||||
addBindingHandler(languageModule,new ElementInterfaceBindingHandler(),"cel-interface-bind","Binds the ElementInterface childeren.");
|
addBindingHandler(languageModule,new ElementInterfaceBindingHandler(),"cel-interface-bind","Binds the ElementInterface childeren.");
|
||||||
addBindingHandler(languageModule,new ElementNamespaceContextBindingHandler(),"cel-namespace-bind","Binds the Namespace childeren.");
|
addBindingHandler(languageModule,new ElementNamespaceBindingHandler(),"cel-namespace-bind","Binds the Namespace childeren.");
|
||||||
|
|
||||||
// Create cel-lang namespace in language
|
// Create cel-lang namespace in language
|
||||||
ElementNamespaceContext namespace = createNamespaceContext(language,CEL_CORE,CEL_CORE_URI,CEL_CORE_XSD_URI,CEL_CORE_XSD_FILE,CEL_CORE);
|
ElementNamespace namespace = createNamespaceContext(language,CEL_CORE,CEL_CORE_URI,CEL_CORE_XSD_URI,CEL_CORE_XSD_FILE,CEL_CORE);
|
||||||
configElementClasses(language,namespace);
|
configElementClasses(language,namespace);
|
||||||
startAndAddNamespace(language,languageModule,namespace);
|
startAndAddNamespace(language,languageModule,namespace);
|
||||||
|
|
||||||
// Create cel-root namespace in language for schema support
|
// Create cel-root namespace in language for schema support
|
||||||
ElementNamespaceContext namespaceRoot = createNamespaceContext(language,CEL_ROOT,CEL_ROOT_URI,CEL_ROOT_XSD_URI,CEL_ROOT_XSD_FILE,CEL_ROOT);
|
ElementNamespace namespaceRoot = createNamespaceContext(language,CEL_ROOT,CEL_ROOT_URI,CEL_ROOT_XSD_URI,CEL_ROOT_XSD_FILE,CEL_ROOT);
|
||||||
namespaceRoot.setLanguageRoot(true); // Only define single language root so xsd is (mostly) not cicle import.
|
namespaceRoot.setLanguageRoot(true); // Only define single language root so xsd is (mostly) not cicle import.
|
||||||
ElementClass rootElement = createElementClass(language,"module",language.getLanguageConfiguration().getDefaultElementLanguageModule(),ModuleElement.class,"The module tag is the root xml element for ELD language.");
|
ElementClass rootElement = createElementClass(language,"module",language.getLanguageConfiguration().getDefaultElementLanguageModule(),ModuleElement.class,"The module tag is the root xml element for ELD language.");
|
||||||
rootElement.addElementClassAttribute(createElementClassAttribute(language,"id",true,null));
|
rootElement.addElementClassAttribute(createElementClassAttribute(language,"id",true,null));
|
||||||
|
@ -119,7 +119,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
|
||||||
* @param language The language to config for.
|
* @param language The language to config for.
|
||||||
* @throws X4OLanguageModuleLoaderException
|
* @throws X4OLanguageModuleLoaderException
|
||||||
*/
|
*/
|
||||||
private void configElementClasses(X4OLanguage language,ElementNamespaceContext namespace) throws X4OLanguageModuleLoaderException {
|
private void configElementClasses(X4OLanguage language,ElementNamespace namespace) throws X4OLanguageModuleLoaderException {
|
||||||
ElementClass ec = null;
|
ElementClass ec = null;
|
||||||
|
|
||||||
namespace.addElementClass(createElementClass(language,"attribute",language.getLanguageConfiguration().getDefaultElementClassAttribute(),null,"Defines xml element attribute."));
|
namespace.addElementClass(createElementClass(language,"attribute",language.getLanguageConfiguration().getDefaultElementClassAttribute(),null,"Defines xml element attribute."));
|
||||||
|
@ -131,7 +131,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
|
||||||
|
|
||||||
namespace.addElementClass(createElementClass(language,"classConverter",ClassConverter.class,null,"Converts string attribute to java class instance."));
|
namespace.addElementClass(createElementClass(language,"classConverter",ClassConverter.class,null,"Converts string attribute to java class instance."));
|
||||||
|
|
||||||
ec = createElementClass(language,"namespace",language.getLanguageConfiguration().getDefaultElementNamespaceContext(),null,"Defines an xml namespace.");
|
ec = createElementClass(language,"namespace",language.getLanguageConfiguration().getDefaultElementNamespace(),null,"Defines an xml namespace.");
|
||||||
ec.addElementClassAttribute(createElementClassAttribute(language,"uri",true,null));
|
ec.addElementClassAttribute(createElementClassAttribute(language,"uri",true,null));
|
||||||
namespace.addElementClass(ec);
|
namespace.addElementClass(ec);
|
||||||
|
|
||||||
|
@ -197,20 +197,20 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
|
||||||
languageModule.setSourceResource(this.getClass().getSimpleName()); //TODO: check if oke.
|
languageModule.setSourceResource(this.getClass().getSimpleName()); //TODO: check if oke.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startAndAddNamespace(X4OLanguageLocal language,X4OLanguageModule languageModule,ElementNamespaceContext namespace) throws X4OLanguageModuleLoaderException {
|
private void startAndAddNamespace(X4OLanguageLocal language,X4OLanguageModule languageModule,ElementNamespace namespace) throws X4OLanguageModuleLoaderException {
|
||||||
try {
|
try {
|
||||||
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
namespace.getElementNamespaceInstanceProvider().start(language, namespace);
|
||||||
} catch (ElementNamespaceInstanceProviderException e) {
|
} catch (ElementNamespaceInstanceProviderException e) {
|
||||||
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,"Error starting instance provider: "+e.getMessage(),e);
|
||||||
}
|
}
|
||||||
languageModule.addElementNamespaceContext(namespace);
|
languageModule.addElementNamespace(namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ElementNamespaceContext createNamespaceContext(X4OLanguageLocal language,String id,String uri,String schemaUri,String schemaResource,String schemaPrefix) throws X4OLanguageModuleLoaderException {
|
private ElementNamespace createNamespaceContext(X4OLanguageLocal language,String id,String uri,String schemaUri,String schemaResource,String schemaPrefix) throws X4OLanguageModuleLoaderException {
|
||||||
logger.finer("Creating "+language.getLanguageName()+" namespace.");
|
logger.finer("Creating "+language.getLanguageName()+" namespace.");
|
||||||
ElementNamespaceContext namespace;
|
ElementNamespace namespace;
|
||||||
try {
|
try {
|
||||||
namespace = (ElementNamespaceContext)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespaceContext());
|
namespace = (ElementNamespace)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementNamespace());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
throw new X4OLanguageModuleLoaderException(this,e.getMessage(),e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -49,7 +49,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
|
||||||
|
|
||||||
private final static Class<?>[] CLASSES_CHILD = new Class[] {
|
private final static Class<?>[] CLASSES_CHILD = new Class[] {
|
||||||
ElementInterface.class,
|
ElementInterface.class,
|
||||||
ElementNamespaceContext.class,
|
ElementNamespace.class,
|
||||||
ElementBindingHandler.class,
|
ElementBindingHandler.class,
|
||||||
ElementAttributeHandler.class,
|
ElementAttributeHandler.class,
|
||||||
ElementConfiguratorGlobal.class,
|
ElementConfiguratorGlobal.class,
|
||||||
|
@ -88,62 +88,62 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
|
||||||
languageModule.addElementInterface(elementInterface);
|
languageModule.addElementInterface(elementInterface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (childObject instanceof ElementNamespaceContext) {
|
if (childObject instanceof ElementNamespace) {
|
||||||
ElementNamespaceContext elementNamespaceContext = (ElementNamespaceContext)childObject;
|
ElementNamespace elementNamespace = (ElementNamespace)childObject;
|
||||||
|
|
||||||
if (elementNamespaceContext.getId()==null) {
|
if (elementNamespace.getId()==null) {
|
||||||
throw new NullPointerException("Can add ElementNamespaceContext without id.");
|
throw new NullPointerException("Can add elementNamespace without id.");
|
||||||
}
|
}
|
||||||
// TODO: no language here so move to EL default on eld attribute tag
|
// TODO: no language here so move to EL default on eld attribute tag
|
||||||
if (elementNamespaceContext.getId()!=null) {
|
if (elementNamespace.getId()!=null) {
|
||||||
StringBuffer buf = new StringBuffer(30);
|
StringBuffer buf = new StringBuffer(30);
|
||||||
for (char c:elementNamespaceContext.getId().toLowerCase().toCharArray()) {
|
for (char c:elementNamespace.getId().toLowerCase().toCharArray()) {
|
||||||
if (Character.isLetter(c)) {buf.append(c);}
|
if (Character.isLetter(c)) {buf.append(c);}
|
||||||
if (Character.isDigit(c)) {buf.append(c);}
|
if (Character.isDigit(c)) {buf.append(c);}
|
||||||
if ('-'==c) {buf.append(c);}
|
if ('-'==c) {buf.append(c);}
|
||||||
}
|
}
|
||||||
String id = buf.toString();
|
String id = buf.toString();
|
||||||
elementNamespaceContext.setId(id);
|
elementNamespace.setId(id);
|
||||||
}
|
}
|
||||||
if (elementNamespaceContext.getUri()==null) {
|
if (elementNamespace.getUri()==null) {
|
||||||
elementNamespaceContext.setUri(
|
elementNamespace.setUri(
|
||||||
"http://"+languageModule.getProviderHost()+
|
"http://"+languageModule.getProviderHost()+
|
||||||
"/xml/ns/"+x4oParsingContext.getLanguageName()+
|
"/xml/ns/"+x4oParsingContext.getLanguageName()+
|
||||||
"-"+elementNamespaceContext.getId());
|
"-"+elementNamespace.getId());
|
||||||
}
|
}
|
||||||
if (elementNamespaceContext.getSchemaUri()==null) {
|
if (elementNamespace.getSchemaUri()==null) {
|
||||||
elementNamespaceContext.setSchemaUri(
|
elementNamespace.setSchemaUri(
|
||||||
"http://"+languageModule.getProviderHost()+
|
"http://"+languageModule.getProviderHost()+
|
||||||
"/xml/ns/"+x4oParsingContext.getLanguageName()+
|
"/xml/ns/"+x4oParsingContext.getLanguageName()+
|
||||||
"-"+elementNamespaceContext.getId()+
|
"-"+elementNamespace.getId()+
|
||||||
"-"+x4oParsingContext.getLanguageVersion()+
|
"-"+x4oParsingContext.getLanguageVersion()+
|
||||||
".xsd"
|
".xsd"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (elementNamespaceContext.getSchemaResource()==null) {
|
if (elementNamespace.getSchemaResource()==null) {
|
||||||
elementNamespaceContext.setSchemaResource(
|
elementNamespace.setSchemaResource(
|
||||||
x4oParsingContext.getLanguageName()+
|
x4oParsingContext.getLanguageName()+
|
||||||
"-"+elementNamespaceContext.getId()+
|
"-"+elementNamespace.getId()+
|
||||||
"-"+x4oParsingContext.getLanguageVersion()+
|
"-"+x4oParsingContext.getLanguageVersion()+
|
||||||
".xsd"
|
".xsd"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (elementNamespaceContext.getSchemaPrefix()==null) {
|
if (elementNamespace.getSchemaPrefix()==null) {
|
||||||
elementNamespaceContext.setSchemaPrefix(elementNamespaceContext.getId());
|
elementNamespace.setSchemaPrefix(elementNamespace.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
elementNamespaceContext.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)X4OLanguageClassLoader.newInstance(childElement.getLanguageContext().getLanguage().getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider()));
|
elementNamespace.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)X4OLanguageClassLoader.newInstance(childElement.getLanguageContext().getLanguage().getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ElementBindingHandlerException("Error loading: "+e.getMessage(),e);
|
throw new ElementBindingHandlerException("Error loading: "+e.getMessage(),e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
elementNamespaceContext.getElementNamespaceInstanceProvider().start(x4oParsingContext, elementNamespaceContext);
|
elementNamespace.getElementNamespaceInstanceProvider().start(x4oParsingContext, elementNamespace);
|
||||||
} catch (ElementNamespaceInstanceProviderException e) {
|
} catch (ElementNamespaceInstanceProviderException e) {
|
||||||
throw new ElementBindingHandlerException("Error starting: "+e.getMessage(),e);
|
throw new ElementBindingHandlerException("Error starting: "+e.getMessage(),e);
|
||||||
}
|
}
|
||||||
languageModule.addElementNamespaceContext(elementNamespaceContext);
|
languageModule.addElementNamespace(elementNamespace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (childObject instanceof ElementBindingHandler) {
|
if (childObject instanceof ElementBindingHandler) {
|
||||||
|
@ -170,7 +170,7 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
|
||||||
for (ElementInterface child:parent.getElementInterfaces()) {
|
for (ElementInterface child:parent.getElementInterfaces()) {
|
||||||
createChild(parentElement, child);
|
createChild(parentElement, child);
|
||||||
}
|
}
|
||||||
for (ElementNamespaceContext child:parent.getElementNamespaceContexts()) {
|
for (ElementNamespace child:parent.getElementNamespaces()) {
|
||||||
createChild(parentElement, child);
|
createChild(parentElement, child);
|
||||||
}
|
}
|
||||||
for (ElementBindingHandler child:parent.getElementBindingHandlers()) {
|
for (ElementBindingHandler child:parent.getElementBindingHandlers()) {
|
||||||
|
|
|
@ -26,15 +26,15 @@ import org.x4o.xml.element.AbstractElementBindingHandler;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementNamespaceContextBindingHandler binds ElementClass into namespace.
|
* ElementNamespaceBindingHandler binds ElementClass into namespace.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Aug 21, 2012
|
* @version 1.0 Aug 21, 2012
|
||||||
*/
|
*/
|
||||||
public class ElementNamespaceContextBindingHandler extends AbstractElementBindingHandler<ElementNamespaceContext> {
|
public class ElementNamespaceBindingHandler extends AbstractElementBindingHandler<ElementNamespace> {
|
||||||
|
|
||||||
private final static Class<?>[] CLASSES_CHILD = new Class[] {
|
private final static Class<?>[] CLASSES_CHILD = new Class[] {
|
||||||
ElementClass.class
|
ElementClass.class
|
||||||
|
@ -44,7 +44,7 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
|
||||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||||
*/
|
*/
|
||||||
public Class<?> getBindParentClass() {
|
public Class<?> getBindParentClass() {
|
||||||
return ElementNamespaceContext.class;
|
return ElementNamespace.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
|
* @see org.x4o.xml.element.AbstractElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void bindChild(Element childElement,ElementNamespaceContext parent, Object childObject) throws ElementBindingHandlerException {
|
public void bindChild(Element childElement,ElementNamespace parent, Object childObject) throws ElementBindingHandlerException {
|
||||||
if (childObject instanceof ElementClass) {
|
if (childObject instanceof ElementClass) {
|
||||||
ElementClass elementClass = (ElementClass)childObject;
|
ElementClass elementClass = (ElementClass)childObject;
|
||||||
if (elementClass.getId()==null && elementClass.getObjectClass()!=null) {
|
if (elementClass.getId()==null && elementClass.getObjectClass()!=null) {
|
||||||
|
@ -70,7 +70,7 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void createChilderen(Element parentElement,ElementNamespaceContext parent) throws ElementBindingHandlerException {
|
public void createChilderen(Element parentElement,ElementNamespace parent) throws ElementBindingHandlerException {
|
||||||
for (ElementClass child:parent.getElementClasses()) {
|
for (ElementClass child:parent.getElementClasses()) {
|
||||||
createChild(parentElement, child);
|
createChild(parentElement, child);
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import java.io.Writer;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.DefaultX4OSchemaWriter;
|
import org.x4o.xml.io.DefaultX4OSchemaWriter;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterXml;
|
import org.x4o.xml.io.sax.ext.ContentWriterXml;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterXsd;
|
import org.x4o.xml.io.sax.ext.ContentWriterXsd;
|
||||||
|
@ -54,7 +54,7 @@ public class EldXsdXmlGenerator {
|
||||||
this.propertyConfig=propertyConfig;
|
this.propertyConfig=propertyConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNamespace(ElementNamespaceContext ns) {
|
private void checkNamespace(ElementNamespace ns) {
|
||||||
if (ns.getSchemaResource()==null) {
|
if (ns.getSchemaResource()==null) {
|
||||||
throw new NullPointerException("Can't generate xsd for namespace without schemaResource uri: "+ns.getUri());
|
throw new NullPointerException("Can't generate xsd for namespace without schemaResource uri: "+ns.getUri());
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class EldXsdXmlGenerator {
|
||||||
|
|
||||||
|
|
||||||
if (namespace!=null) {
|
if (namespace!=null) {
|
||||||
ElementNamespaceContext ns = language.findElementNamespaceContext(namespace);
|
ElementNamespace ns = language.findElementNamespace(namespace);
|
||||||
if (ns==null) {
|
if (ns==null) {
|
||||||
throw new NullPointerException("Could not find namespace: "+namespace);
|
throw new NullPointerException("Could not find namespace: "+namespace);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class EldXsdXmlGenerator {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
checkNamespace(ns);
|
checkNamespace(ns);
|
||||||
File outputFile = new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource());
|
File outputFile = new File(basePath.getAbsolutePath()+File.separatorChar+ns.getSchemaResource());
|
||||||
Writer wr = new OutputStreamWriter(new FileOutputStream(outputFile), encoding);
|
Writer wr = new OutputStreamWriter(new FileOutputStream(outputFile), encoding);
|
||||||
|
@ -111,7 +111,7 @@ public class EldXsdXmlGenerator {
|
||||||
|
|
||||||
public void generateSchema(String namespaceUri,ContentWriterXsd xmlWriter) throws SAXException {
|
public void generateSchema(String namespaceUri,ContentWriterXsd xmlWriter) throws SAXException {
|
||||||
|
|
||||||
ElementNamespaceContext ns = language.findElementNamespaceContext(namespaceUri);
|
ElementNamespace ns = language.findElementNamespace(namespaceUri);
|
||||||
if (ns==null) {
|
if (ns==null) {
|
||||||
throw new NullPointerException("Could not find namespace: "+namespaceUri);
|
throw new NullPointerException("Could not find namespace: "+namespaceUri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementMetaBase;
|
import org.x4o.xml.element.ElementMetaBase;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.XMLConstants;
|
import org.x4o.xml.io.XMLConstants;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterXsd;
|
import org.x4o.xml.io.sax.ext.ContentWriterXsd;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -112,13 +112,13 @@ public class EldXsdXmlWriter {
|
||||||
|
|
||||||
// redo this mess, add nice find for binding handlers
|
// redo this mess, add nice find for binding handlers
|
||||||
for (X4OLanguageModule modContext:language.getLanguageModules()) {
|
for (X4OLanguageModule modContext:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
for (ElementNamespace nsContext:modContext.getElementNamespaces()) {
|
||||||
for (ElementClass ec:nsContext.getElementClasses()) {
|
for (ElementClass ec:nsContext.getElementClasses()) {
|
||||||
Class<?> objectClass = null;
|
Class<?> objectClass = null;
|
||||||
if (ec.getObjectClass()!=null) {
|
if (ec.getObjectClass()!=null) {
|
||||||
objectClass = ec.getObjectClass();
|
objectClass = ec.getObjectClass();
|
||||||
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
for (ElementClass checkClass:ns.getElementClasses()) {
|
for (ElementClass checkClass:ns.getElementClasses()) {
|
||||||
if (checkClass.getObjectClass()==null) {
|
if (checkClass.getObjectClass()==null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -147,7 +147,7 @@ public class EldXsdXmlWriter {
|
||||||
private static final String COMMENT_SEPERATOR = " ==================================================================== ";
|
private static final String COMMENT_SEPERATOR = " ==================================================================== ";
|
||||||
private static final String COMMENT_TEXT = "=====";
|
private static final String COMMENT_TEXT = "=====";
|
||||||
|
|
||||||
public void startSchema(ElementNamespaceContext ns) throws SAXException {
|
public void startSchema(ElementNamespace ns) throws SAXException {
|
||||||
|
|
||||||
xmlWriter.startDocument();
|
xmlWriter.startDocument();
|
||||||
xmlWriter.ignorableWhitespace(XMLConstants.CHAR_NEWLINE);
|
xmlWriter.ignorableWhitespace(XMLConstants.CHAR_NEWLINE);
|
||||||
|
@ -174,7 +174,7 @@ public class EldXsdXmlWriter {
|
||||||
|
|
||||||
X4OLanguageModule module = null;
|
X4OLanguageModule module = null;
|
||||||
for (X4OLanguageModule elm:language.getLanguageModules()) {
|
for (X4OLanguageModule elm:language.getLanguageModules()) {
|
||||||
ElementNamespaceContext s = elm.getElementNamespaceContext(ns.getUri());
|
ElementNamespace s = elm.getElementNamespace(ns.getUri());
|
||||||
if (s!=null) {
|
if (s!=null) {
|
||||||
module = elm;
|
module = elm;
|
||||||
break;
|
break;
|
||||||
|
@ -185,7 +185,7 @@ public class EldXsdXmlWriter {
|
||||||
b.append("\n\tID:\t\t"); b.append(module.getId());
|
b.append("\n\tID:\t\t"); b.append(module.getId());
|
||||||
b.append("\n\tProviderName:\t"); b.append(module.getProviderName());
|
b.append("\n\tProviderName:\t"); b.append(module.getProviderName());
|
||||||
b.append("\n\tProviderHost:\t"); b.append(module.getProviderHost());
|
b.append("\n\tProviderHost:\t"); b.append(module.getProviderHost());
|
||||||
b.append("\n\tNamespaces:\t\t"); b.append(module.getElementNamespaceContexts().size());
|
b.append("\n\tNamespaces:\t\t"); b.append(module.getElementNamespaces().size());
|
||||||
b.append("\n\tUri:\t\t\t"); b.append(ns.getUri());
|
b.append("\n\tUri:\t\t\t"); b.append(ns.getUri());
|
||||||
b.append("\n\tUri schema:\t"); b.append(ns.getSchemaUri());
|
b.append("\n\tUri schema:\t"); b.append(ns.getSchemaUri());
|
||||||
b.append("\n\tCreated on:\t\t"); b.append(new Date());
|
b.append("\n\tCreated on:\t\t"); b.append(new Date());
|
||||||
|
@ -211,7 +211,7 @@ public class EldXsdXmlWriter {
|
||||||
if (ns.getUri().equals(uri)) {
|
if (ns.getUri().equals(uri)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ElementNamespaceContext nsContext = language.findElementNamespaceContext(uri);
|
ElementNamespace nsContext = language.findElementNamespace(uri);
|
||||||
atts = new AttributesImpl();
|
atts = new AttributesImpl();
|
||||||
atts.addAttribute ("", "namespace", "", "", nsContext.getUri());
|
atts.addAttribute ("", "namespace", "", "", nsContext.getUri());
|
||||||
atts.addAttribute ("", "schemaLocation", "", "", nsContext.getSchemaResource());
|
atts.addAttribute ("", "schemaLocation", "", "", nsContext.getSchemaResource());
|
||||||
|
@ -226,7 +226,7 @@ public class EldXsdXmlWriter {
|
||||||
xmlWriter.endDocument();
|
xmlWriter.endDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeElementClass(ElementClass ec,ElementNamespaceContext nsWrite) throws SAXException {
|
public void writeElementClass(ElementClass ec,ElementNamespace nsWrite) throws SAXException {
|
||||||
|
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
if (nsWrite.getLanguageRoot()!=null && nsWrite.getLanguageRoot()) {
|
if (nsWrite.getLanguageRoot()!=null && nsWrite.getLanguageRoot()) {
|
||||||
|
@ -262,7 +262,7 @@ public class EldXsdXmlWriter {
|
||||||
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
|
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
|
||||||
|
|
||||||
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
for (X4OLanguageModule mod:language.getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
writeElementClassNamespaces(ec,nsWrite,ns);
|
writeElementClassNamespaces(ec,nsWrite,ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ public class EldXsdXmlWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeElementClassNamespaces(ElementClass ecWrite,ElementNamespaceContext nsWrite,ElementNamespaceContext ns) throws SAXException {
|
private void writeElementClassNamespaces(ElementClass ecWrite,ElementNamespace nsWrite,ElementNamespace ns) throws SAXException {
|
||||||
AttributesImpl atts = new AttributesImpl();
|
AttributesImpl atts = new AttributesImpl();
|
||||||
List<String> refElements = new ArrayList<String>(20);
|
List<String> refElements = new ArrayList<String>(20);
|
||||||
for (ElementClass checkClass:ns.getElementClasses()) {
|
for (ElementClass checkClass:ns.getElementClasses()) {
|
||||||
|
@ -417,7 +417,7 @@ public class EldXsdXmlWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void writeElement(ElementClass ec,ElementNamespaceContext nsWrite) throws SAXException {
|
public void writeElement(ElementClass ec,ElementNamespace nsWrite) throws SAXException {
|
||||||
if (nsWrite.getLanguageRoot()!=null && nsWrite.getLanguageRoot()) {
|
if (nsWrite.getLanguageRoot()!=null && nsWrite.getLanguageRoot()) {
|
||||||
return; // is done in writeElementClass
|
return; // is done in writeElementClass
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,12 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The abstract verion of ElementNamespaceContext
|
* AbstractElementNamespace is the abstract version of an ElementNamespace.
|
||||||
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Oct 28, 2009
|
* @version 1.0 Oct 28, 2009
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractElementNamespaceContext extends AbstractElementMetaBase implements ElementNamespaceContext {
|
public abstract class AbstractElementNamespace extends AbstractElementMetaBase implements ElementNamespace {
|
||||||
|
|
||||||
private ElementNamespaceInstanceProvider elementNamespaceInstanceProvider = null;
|
private ElementNamespaceInstanceProvider elementNamespaceInstanceProvider = null;
|
||||||
private String prefixMapping = null;
|
private String prefixMapping = null;
|
||||||
|
@ -44,12 +45,12 @@ public abstract class AbstractElementNamespaceContext extends AbstractElementMet
|
||||||
private String schemaPrefix = null;
|
private String schemaPrefix = null;
|
||||||
private Boolean languageRoot = null;
|
private Boolean languageRoot = null;
|
||||||
|
|
||||||
public AbstractElementNamespaceContext() {
|
public AbstractElementNamespace() {
|
||||||
elementClasses = new HashMap<String,ElementClass>(100);
|
elementClasses = new HashMap<String,ElementClass>(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementNamespaceContext#getPrefixMapping()
|
* @see org.x4o.xml.element.ElementNamespace#getPrefixMapping()
|
||||||
*/
|
*/
|
||||||
public String getPrefixMapping() {
|
public String getPrefixMapping() {
|
||||||
return prefixMapping;
|
return prefixMapping;
|
||||||
|
@ -70,14 +71,14 @@ public abstract class AbstractElementNamespaceContext extends AbstractElementMet
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementNamespaceContext#setPrefixMapping(java.lang.String)
|
* @see org.x4o.xml.element.ElementNamespace#setPrefixMapping(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void setPrefixMapping(String prefixMapping) {
|
public void setPrefixMapping(String prefixMapping) {
|
||||||
this.prefixMapping=prefixMapping;
|
this.prefixMapping=prefixMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementNamespaceContext#addElementClass(org.x4o.xml.element.ElementClass)
|
* @see org.x4o.xml.element.ElementNamespace#addElementClass(org.x4o.xml.element.ElementClass)
|
||||||
*/
|
*/
|
||||||
public void addElementClass(ElementClass elementClass) {
|
public void addElementClass(ElementClass elementClass) {
|
||||||
if (elementClass.getId()==null) {
|
if (elementClass.getId()==null) {
|
||||||
|
@ -87,14 +88,14 @@ public abstract class AbstractElementNamespaceContext extends AbstractElementMet
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementNamespaceContext#getElementClass(java.lang.String)
|
* @see org.x4o.xml.element.ElementNamespace#getElementClass(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ElementClass getElementClass(String tag) {
|
public ElementClass getElementClass(String tag) {
|
||||||
return elementClasses.get(tag);
|
return elementClasses.get(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.element.ElementNamespaceContext#getElementClasses()
|
* @see org.x4o.xml.element.ElementNamespace#getElementClasses()
|
||||||
*/
|
*/
|
||||||
public List<ElementClass> getElementClasses() {
|
public List<ElementClass> getElementClasses() {
|
||||||
return new ArrayList<ElementClass>(elementClasses.values());
|
return new ArrayList<ElementClass>(elementClasses.values());
|
|
@ -24,11 +24,11 @@ package org.x4o.xml.element;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default namespace context.
|
* DefaultElementNamespace is the default element namespace implementation.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Oct 28, 2009
|
* @version 1.0 Oct 28, 2009
|
||||||
*/
|
*/
|
||||||
public class DefaultElementNamespaceContext extends AbstractElementNamespaceContext {
|
public class DefaultElementNamespace extends AbstractElementNamespace {
|
||||||
|
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.lang.X4OLanguageClassLoader;
|
||||||
public class DefaultElementNamespaceInstanceProvider implements ElementNamespaceInstanceProvider {
|
public class DefaultElementNamespaceInstanceProvider implements ElementNamespaceInstanceProvider {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private ElementNamespaceContext elementNamespaceContext = null;
|
private ElementNamespace elementNamespace = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new DefaultElementNamespaceInstanceProvider.
|
* Creates new DefaultElementNamespaceInstanceProvider.
|
||||||
|
@ -48,12 +48,12 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param language The elementLanguage of this provider.
|
* @param language The elementLanguage of this provider.
|
||||||
* @param elementNamespaceContext The elementNamespaceContext for this provider.
|
* @param elementNamespace The elementNamespace for this provider.
|
||||||
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguage, org.x4o.xml.element.ElementNamespaceContext)
|
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#start(org.x4o.xml.lang.X4OLanguage, org.x4o.xml.element.ElementNamespace)
|
||||||
*/
|
*/
|
||||||
public void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) {
|
public void start(X4OLanguage language,ElementNamespace elementNamespace) {
|
||||||
this.elementNamespaceContext=elementNamespaceContext;
|
this.elementNamespace=elementNamespace;
|
||||||
logger.finer("Starting DefaultElementNamespaceInstanceProvider for: "+elementNamespaceContext.getUri());
|
logger.finer("Starting DefaultElementNamespaceInstanceProvider for: "+elementNamespace.getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,11 +64,11 @@ public class DefaultElementNamespaceInstanceProvider implements ElementNamespace
|
||||||
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(org.x4o.xml.lang.X4OLanguageContext,java.lang.String)
|
* @see org.x4o.xml.element.ElementNamespaceInstanceProvider#createElementInstance(org.x4o.xml.lang.X4OLanguageContext,java.lang.String)
|
||||||
*/
|
*/
|
||||||
public Element createElementInstance(X4OLanguageContext languageContext,String tag) throws ElementNamespaceInstanceProviderException {
|
public Element createElementInstance(X4OLanguageContext languageContext,String tag) throws ElementNamespaceInstanceProviderException {
|
||||||
ElementClass elementClass = elementNamespaceContext.getElementClass(tag);
|
ElementClass elementClass = elementNamespace.getElementClass(tag);
|
||||||
Element element = null;
|
Element element = null;
|
||||||
|
|
||||||
if (elementClass==null) {
|
if (elementClass==null) {
|
||||||
throw new ElementNamespaceInstanceProviderException(this,"Tag: " + tag + " unknown in: " + elementNamespaceContext.getUri());
|
throw new ElementNamespaceInstanceProviderException(this,"Tag: " + tag + " unknown in: " + elementNamespace.getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -25,12 +25,12 @@ package org.x4o.xml.element;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElementNamespaceContext stores all element tag classes for the namespace.
|
* ElementNamespace stores all element tag classes for the namespace.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Oct 28, 2009
|
* @version 1.0 Oct 28, 2009
|
||||||
*/
|
*/
|
||||||
public interface ElementNamespaceContext extends ElementMetaBase {
|
public interface ElementNamespace extends ElementMetaBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the prefix mapping.
|
* Sets the prefix mapping.
|
|
@ -36,10 +36,10 @@ public interface ElementNamespaceInstanceProvider {
|
||||||
/**
|
/**
|
||||||
* Starts the ElementProvider.
|
* Starts the ElementProvider.
|
||||||
* @param language The X4OLanguage to start in.
|
* @param language The X4OLanguage to start in.
|
||||||
* @param elementNamespaceContext The ElementNamespaceContext to start for.
|
* @param elementNamespace The elementNamespace to start for.
|
||||||
* @throws ElementNamespaceInstanceProviderException Thrown when error happened in language.
|
* @throws ElementNamespaceInstanceProviderException Thrown when error happened in language.
|
||||||
*/
|
*/
|
||||||
void start(X4OLanguage language,ElementNamespaceContext elementNamespaceContext) throws ElementNamespaceInstanceProviderException;
|
void start(X4OLanguage language,ElementNamespace elementNamespace) throws ElementNamespaceInstanceProviderException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide an Element for an xml tag.
|
* Provide an Element for an xml tag.
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValueException;
|
import org.x4o.xml.element.ElementObjectPropertyValueException;
|
||||||
import org.x4o.xml.io.sax.ext.PropertyConfig;
|
import org.x4o.xml.io.sax.ext.PropertyConfig;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterXml;
|
import org.x4o.xml.io.sax.ext.ContentWriterXml;
|
||||||
|
@ -128,7 +128,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
||||||
Element root = languageContext.getRootElement();
|
Element root = languageContext.getRootElement();
|
||||||
if (schemaUriRoot==null) {
|
if (schemaUriRoot==null) {
|
||||||
String rootUri = findElementUri(root);
|
String rootUri = findElementUri(root);
|
||||||
ElementNamespaceContext ns = languageContext.getLanguage().findElementNamespaceContext(rootUri);
|
ElementNamespace ns = languageContext.getLanguage().findElementNamespace(rootUri);
|
||||||
if (ns!=null) {
|
if (ns!=null) {
|
||||||
schemaUriRoot = ns.getSchemaUri();
|
schemaUriRoot = ns.getSchemaUri();
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
||||||
|
|
||||||
private String findElementUri(Element e) {
|
private String findElementUri(Element e) {
|
||||||
for (X4OLanguageModule mod:e.getLanguageContext().getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:e.getLanguageContext().getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext c:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace c:mod.getElementNamespaces()) {
|
||||||
ElementClass ec = c.getElementClass(e.getElementClass().getId());
|
ElementClass ec = c.getElementClass(e.getElementClass().getId());
|
||||||
if (ec!=null) {
|
if (ec!=null) {
|
||||||
return c.getUri();
|
return c.getUri();
|
||||||
|
@ -327,7 +327,7 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String findNamespacePrefix(Element e,String uri) {
|
private String findNamespacePrefix(Element e,String uri) {
|
||||||
ElementNamespaceContext ns = e.getLanguageContext().getLanguage().findElementNamespaceContext(uri);
|
ElementNamespace ns = e.getLanguageContext().getLanguage().findElementNamespace(uri);
|
||||||
if (ns.getPrefixMapping()!=null) {
|
if (ns.getPrefixMapping()!=null) {
|
||||||
return ns.getPrefixMapping();
|
return ns.getPrefixMapping();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ package org.x4o.xml.io.sax;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.Element.ElementType;
|
import org.x4o.xml.element.Element.ElementType;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.io.DefaultX4OReader;
|
import org.x4o.xml.io.DefaultX4OReader;
|
||||||
import org.x4o.xml.io.sax.ext.AttributeMap;
|
import org.x4o.xml.io.sax.ext.AttributeMap;
|
||||||
|
@ -106,7 +106,7 @@ public class X4OContentHandler extends DefaultHandler2 {
|
||||||
if ("http://www.w3.org/2001/XInclude".equals(namespaceUri)) {
|
if ("http://www.w3.org/2001/XInclude".equals(namespaceUri)) {
|
||||||
return; // skip xinclude ns.
|
return; // skip xinclude ns.
|
||||||
}
|
}
|
||||||
ElementNamespaceContext enc = elementLanguage.getLanguage().findElementNamespaceContext(namespaceUri);
|
ElementNamespace enc = elementLanguage.getLanguage().findElementNamespace(namespaceUri);
|
||||||
if (enc==null) {
|
if (enc==null) {
|
||||||
throw new SAXException("Can't find namespace uri: "+namespaceUri+" in language: "+elementLanguage.getLanguage().getLanguageName());
|
throw new SAXException("Can't find namespace uri: "+namespaceUri+" in language: "+elementLanguage.getLanguage().getLanguageName());
|
||||||
}
|
}
|
||||||
|
@ -125,16 +125,16 @@ public class X4OContentHandler extends DefaultHandler2 {
|
||||||
overrideSaxHandler.startElement(namespaceUri, tag, qName, attributes);
|
overrideSaxHandler.startElement(namespaceUri, tag, qName, attributes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ElementNamespaceContext enc = elementLanguage.getLanguage().findElementNamespaceContext(namespaceUri);
|
ElementNamespace enc = elementLanguage.getLanguage().findElementNamespace(namespaceUri);
|
||||||
if (enc==null) {
|
if (enc==null) {
|
||||||
if ("".equals(namespaceUri)) {
|
if ("".equals(namespaceUri)) {
|
||||||
String configEmptryUri = propertyConfig.getPropertyString(DefaultX4OReader.DOC_EMPTY_NAMESPACE_URI);
|
String configEmptryUri = propertyConfig.getPropertyString(DefaultX4OReader.DOC_EMPTY_NAMESPACE_URI);
|
||||||
if (configEmptryUri!=null) {
|
if (configEmptryUri!=null) {
|
||||||
namespaceUri = configEmptryUri;
|
namespaceUri = configEmptryUri;
|
||||||
enc = elementLanguage.getLanguage().findElementNamespaceContext(namespaceUri);
|
enc = elementLanguage.getLanguage().findElementNamespace(namespaceUri);
|
||||||
}
|
}
|
||||||
if (enc==null) {
|
if (enc==null) {
|
||||||
throw new SAXParseException("No ElementNamespaceContext found for empty namespace.",locator);
|
throw new SAXParseException("No ElementNamespace found for empty namespace.",locator);
|
||||||
}
|
}
|
||||||
enc.setPrefixMapping("");
|
enc.setPrefixMapping("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.ElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriter;
|
import org.x4o.xml.io.sax.ext.ContentWriter;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -142,7 +142,7 @@ public class X4ODebugWriter {
|
||||||
contentWriter.startElement (DEBUG_URI, "X4OLanguageDefaultClasses", "", atts);
|
contentWriter.startElement (DEBUG_URI, "X4OLanguageDefaultClasses", "", atts);
|
||||||
X4OLanguageConfiguration conf = ec.getLanguage().getLanguageConfiguration();
|
X4OLanguageConfiguration conf = ec.getLanguage().getLanguageConfiguration();
|
||||||
|
|
||||||
debugLanguageDefaultClass("getDefaultElementNamespaceContext",conf.getDefaultElementNamespaceContext());
|
debugLanguageDefaultClass("getDefaultElementNamespace",conf.getDefaultElementNamespace());
|
||||||
debugLanguageDefaultClass("getDefaultElementInterface",conf.getDefaultElementInterface());
|
debugLanguageDefaultClass("getDefaultElementInterface",conf.getDefaultElementInterface());
|
||||||
debugLanguageDefaultClass("getDefaultElement",conf.getDefaultElement());
|
debugLanguageDefaultClass("getDefaultElement",conf.getDefaultElement());
|
||||||
debugLanguageDefaultClass("getDefaultElementClass",conf.getDefaultElementClass());
|
debugLanguageDefaultClass("getDefaultElementClass",conf.getDefaultElementClass());
|
||||||
|
@ -234,7 +234,7 @@ public class X4ODebugWriter {
|
||||||
//module.getElementBindingHandlers();
|
//module.getElementBindingHandlers();
|
||||||
//module.getGlobalElementConfigurators();
|
//module.getGlobalElementConfigurators();
|
||||||
//module.getElementInterfaces();
|
//module.getElementInterfaces();
|
||||||
//module.getElementNamespaceContexts();
|
//module.getElementNamespace();
|
||||||
|
|
||||||
debugElementConfiguratorGlobal(module.getElementConfiguratorGlobals());
|
debugElementConfiguratorGlobal(module.getElementConfiguratorGlobals());
|
||||||
debugElementBindingHandler(module.getElementBindingHandlers());
|
debugElementBindingHandler(module.getElementBindingHandlers());
|
||||||
|
@ -265,7 +265,7 @@ public class X4ODebugWriter {
|
||||||
contentWriter.endElement(DEBUG_URI, "elementInterface", "");
|
contentWriter.endElement(DEBUG_URI, "elementInterface", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ElementNamespaceContext enc:module.getElementNamespaceContexts()) {
|
for (ElementNamespace enc:module.getElementNamespaces()) {
|
||||||
atts = new AttributesImpl();
|
atts = new AttributesImpl();
|
||||||
atts.addAttribute ("", "uri", "", "", enc.getUri());
|
atts.addAttribute ("", "uri", "", "", enc.getUri());
|
||||||
atts.addAttribute ("", "description", "", "", enc.getDescription());
|
atts.addAttribute ("", "description", "", "", enc.getDescription());
|
||||||
|
@ -273,7 +273,7 @@ public class X4ODebugWriter {
|
||||||
atts.addAttribute ("", "schemaResource", "", "", enc.getSchemaResource());
|
atts.addAttribute ("", "schemaResource", "", "", enc.getSchemaResource());
|
||||||
atts.addAttribute ("", "className", "", "", enc.getClass().getName());
|
atts.addAttribute ("", "className", "", "", enc.getClass().getName());
|
||||||
|
|
||||||
contentWriter.startElement (DEBUG_URI, ElementNamespaceContext.class.getSimpleName(), "", atts);
|
contentWriter.startElement (DEBUG_URI, ElementNamespace.class.getSimpleName(), "", atts);
|
||||||
for (ElementClass ec:enc.getElementClasses()) {
|
for (ElementClass ec:enc.getElementClasses()) {
|
||||||
debugElementClass(ec);
|
debugElementClass(ec);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public class X4ODebugWriter {
|
||||||
contentWriter.startElement (DEBUG_URI, ElementNamespaceInstanceProvider.class.getSimpleName(), "", atts);
|
contentWriter.startElement (DEBUG_URI, ElementNamespaceInstanceProvider.class.getSimpleName(), "", atts);
|
||||||
contentWriter.endElement(DEBUG_URI, ElementNamespaceInstanceProvider.class.getSimpleName(), "");
|
contentWriter.endElement(DEBUG_URI, ElementNamespaceInstanceProvider.class.getSimpleName(), "");
|
||||||
|
|
||||||
contentWriter.endElement(DEBUG_URI, ElementNamespaceContext.class.getSimpleName(), "");
|
contentWriter.endElement(DEBUG_URI, ElementNamespace.class.getSimpleName(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
contentWriter.endElement(DEBUG_URI, "ElementLanguageModule", "");
|
contentWriter.endElement(DEBUG_URI, "ElementLanguageModule", "");
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.DefaultX4OReader;
|
import org.x4o.xml.io.DefaultX4OReader;
|
||||||
import org.x4o.xml.io.sax.ext.PropertyConfig;
|
import org.x4o.xml.io.sax.ext.PropertyConfig;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -74,7 +74,7 @@ public class X4OEntityResolver implements EntityResolver {
|
||||||
this.schemaResources=new HashMap<String,String>(20);
|
this.schemaResources=new HashMap<String,String>(20);
|
||||||
this.schemaPathResources=new HashMap<String,String>(20);
|
this.schemaPathResources=new HashMap<String,String>(20);
|
||||||
for (X4OLanguageModule mod:elementContext.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:elementContext.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
if (ns.getSchemaUri()==null) {
|
if (ns.getSchemaUri()==null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,6 @@
|
||||||
*/
|
*/
|
||||||
package org.x4o.xml.lang;
|
package org.x4o.xml.lang;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractX4OLanguageConfiguration.
|
* AbstractX4OLanguageConfiguration.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +33,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
private String languageResourcePathPrefix = null;
|
private String languageResourcePathPrefix = null;
|
||||||
private String languageResourceModulesFileName = null;
|
private String languageResourceModulesFileName = null;
|
||||||
|
|
||||||
private Class<?> defaultElementNamespaceContext = null;
|
private Class<?> defaultElementNamespace = null;
|
||||||
private Class<?> defaultElementInterface = null;
|
private Class<?> defaultElementInterface = null;
|
||||||
private Class<?> defaultElement = null;
|
private Class<?> defaultElement = null;
|
||||||
private Class<?> defaultElementClass = null;
|
private Class<?> defaultElementClass = null;
|
||||||
|
@ -86,24 +82,22 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param languageResourceModulesFileName the languageResourceModulesFileName to set
|
* @param languageResourceModulesFileName the languageResourceModulesFileName to set
|
||||||
*/
|
*/
|
||||||
public void setLanguageResourceModulesFileName(
|
public void setLanguageResourceModulesFileName(String languageResourceModulesFileName) {
|
||||||
String languageResourceModulesFileName) {
|
|
||||||
this.languageResourceModulesFileName = languageResourceModulesFileName;
|
this.languageResourceModulesFileName = languageResourceModulesFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the defaultElementNamespaceContext
|
* @return the defaultElementNamespace
|
||||||
*/
|
*/
|
||||||
public Class<?> getDefaultElementNamespaceContext() {
|
public Class<?> getDefaultElementNamespace() {
|
||||||
return defaultElementNamespaceContext;
|
return defaultElementNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param defaultElementNamespaceContext the defaultElementNamespaceContext to set
|
* @param defaultElementNamespace the defaultElementNamespace to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementNamespaceContext(
|
public void setDefaultElementNamespace(Class<?> defaultElementNamespace) {
|
||||||
Class<?> defaultElementNamespaceContext) {
|
this.defaultElementNamespace = defaultElementNamespace;
|
||||||
this.defaultElementNamespaceContext = defaultElementNamespaceContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,8 +152,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementClassAttribute the defaultElementClassAttribute to set
|
* @param defaultElementClassAttribute the defaultElementClassAttribute to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementClassAttribute(
|
public void setDefaultElementClassAttribute(Class<?> defaultElementClassAttribute) {
|
||||||
Class<?> defaultElementClassAttribute) {
|
|
||||||
this.defaultElementClassAttribute = defaultElementClassAttribute;
|
this.defaultElementClassAttribute = defaultElementClassAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,8 +166,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementLanguageModule the defaultElementLanguageModule to set
|
* @param defaultElementLanguageModule the defaultElementLanguageModule to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementLanguageModule(
|
public void setDefaultElementLanguageModule(Class<?> defaultElementLanguageModule) {
|
||||||
Class<?> defaultElementLanguageModule) {
|
|
||||||
this.defaultElementLanguageModule = defaultElementLanguageModule;
|
this.defaultElementLanguageModule = defaultElementLanguageModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +194,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementBodyCharacters the defaultElementBodyCharacters to set
|
* @param defaultElementBodyCharacters the defaultElementBodyCharacters to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementBodyCharacters(
|
public void setDefaultElementBodyCharacters(Class<?> defaultElementBodyCharacters) {
|
||||||
Class<?> defaultElementBodyCharacters) {
|
|
||||||
this.defaultElementBodyCharacters = defaultElementBodyCharacters;
|
this.defaultElementBodyCharacters = defaultElementBodyCharacters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +208,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementBodyWhitespace the defaultElementBodyWhitespace to set
|
* @param defaultElementBodyWhitespace the defaultElementBodyWhitespace to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementBodyWhitespace(
|
public void setDefaultElementBodyWhitespace(Class<?> defaultElementBodyWhitespace) {
|
||||||
Class<?> defaultElementBodyWhitespace) {
|
|
||||||
this.defaultElementBodyWhitespace = defaultElementBodyWhitespace;
|
this.defaultElementBodyWhitespace = defaultElementBodyWhitespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,8 +222,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementNamespaceInstanceProvider the defaultElementNamespaceInstanceProvider to set
|
* @param defaultElementNamespaceInstanceProvider the defaultElementNamespaceInstanceProvider to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementNamespaceInstanceProvider(
|
public void setDefaultElementNamespaceInstanceProvider(Class<?> defaultElementNamespaceInstanceProvider) {
|
||||||
Class<?> defaultElementNamespaceInstanceProvider) {
|
|
||||||
this.defaultElementNamespaceInstanceProvider = defaultElementNamespaceInstanceProvider;
|
this.defaultElementNamespaceInstanceProvider = defaultElementNamespaceInstanceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,8 +236,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementAttributeValueParser the defaultElementAttributeValueParser to set
|
* @param defaultElementAttributeValueParser the defaultElementAttributeValueParser to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementAttributeValueParser(
|
public void setDefaultElementAttributeValueParser(Class<?> defaultElementAttributeValueParser) {
|
||||||
Class<?> defaultElementAttributeValueParser) {
|
|
||||||
this.defaultElementAttributeValueParser = defaultElementAttributeValueParser;
|
this.defaultElementAttributeValueParser = defaultElementAttributeValueParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,8 +250,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementObjectPropertyValue the defaultElementObjectPropertyValue to set
|
* @param defaultElementObjectPropertyValue the defaultElementObjectPropertyValue to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementObjectPropertyValue(
|
public void setDefaultElementObjectPropertyValue(Class<?> defaultElementObjectPropertyValue) {
|
||||||
Class<?> defaultElementObjectPropertyValue) {
|
|
||||||
this.defaultElementObjectPropertyValue = defaultElementObjectPropertyValue;
|
this.defaultElementObjectPropertyValue = defaultElementObjectPropertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +264,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultElementAttributeHandlerComparator the defaultElementAttributeHandlerComparator to set
|
* @param defaultElementAttributeHandlerComparator the defaultElementAttributeHandlerComparator to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultElementAttributeHandlerComparator(
|
public void setDefaultElementAttributeHandlerComparator(Class<?> defaultElementAttributeHandlerComparator) {
|
||||||
Class<?> defaultElementAttributeHandlerComparator) {
|
|
||||||
this.defaultElementAttributeHandlerComparator = defaultElementAttributeHandlerComparator;
|
this.defaultElementAttributeHandlerComparator = defaultElementAttributeHandlerComparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,8 +278,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultLanguageVersionFilter the defaultLanguageVersionFilter to set
|
* @param defaultLanguageVersionFilter the defaultLanguageVersionFilter to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultLanguageVersionFilter(
|
public void setDefaultLanguageVersionFilter(Class<?> defaultLanguageVersionFilter) {
|
||||||
Class<?> defaultLanguageVersionFilter) {
|
|
||||||
this.defaultLanguageVersionFilter = defaultLanguageVersionFilter;
|
this.defaultLanguageVersionFilter = defaultLanguageVersionFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,8 +306,7 @@ public abstract class AbstractX4OLanguageConfiguration implements X4OLanguageCon
|
||||||
/**
|
/**
|
||||||
* @param defaultExpressionLanguageContext the defaultExpressionLanguageContext to set
|
* @param defaultExpressionLanguageContext the defaultExpressionLanguageContext to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultExpressionLanguageContext(
|
public void setDefaultExpressionLanguageContext(Class<?> defaultExpressionLanguageContext) {
|
||||||
Class<?> defaultExpressionLanguageContext) {
|
|
||||||
this.defaultExpressionLanguageContext = defaultExpressionLanguageContext;
|
this.defaultExpressionLanguageContext = defaultExpressionLanguageContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An AbstractElementLanguageModule.
|
* An AbstractElementLanguageModule.
|
||||||
|
@ -52,7 +52,7 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
|
||||||
private List<ElementBindingHandler> elementBindingHandlers = null;
|
private List<ElementBindingHandler> elementBindingHandlers = null;
|
||||||
private List<ElementConfiguratorGlobal> elementConfiguratorGlobals = null;
|
private List<ElementConfiguratorGlobal> elementConfiguratorGlobals = null;
|
||||||
private List<ElementInterface> elementInterfaces = null;
|
private List<ElementInterface> elementInterfaces = null;
|
||||||
private Map<String,ElementNamespaceContext> elementNamespaceContexts = null;
|
private Map<String,ElementNamespace> elementNamespaces = null;
|
||||||
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
|
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
|
||||||
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
|
elementBindingHandlers = new ArrayList<ElementBindingHandler>(4);
|
||||||
elementConfiguratorGlobals = new ArrayList<ElementConfiguratorGlobal>(4);
|
elementConfiguratorGlobals = new ArrayList<ElementConfiguratorGlobal>(4);
|
||||||
elementInterfaces = new ArrayList<ElementInterface>(20);
|
elementInterfaces = new ArrayList<ElementInterface>(20);
|
||||||
elementNamespaceContexts = new HashMap<String,ElementNamespaceContext>(10);
|
elementNamespaces = new HashMap<String,ElementNamespace>(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,31 +190,31 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.lang.X4OLanguageModule#addElementNamespaceContext(org.x4o.xml.element.ElementNamespaceContext)
|
* @see org.x4o.xml.lang.X4OLanguageModule#addElementNamespace(org.x4o.xml.element.ElementNamespace)
|
||||||
*/
|
*/
|
||||||
public void addElementNamespaceContext(ElementNamespaceContext elementNamespaceContext) {
|
public void addElementNamespace(ElementNamespace elementNamespace) {
|
||||||
if (elementNamespaceContext==null) {
|
if (elementNamespace==null) {
|
||||||
throw new NullPointerException("Can't add null.");
|
throw new NullPointerException("Can't add null.");
|
||||||
}
|
}
|
||||||
if (elementNamespaceContext.getUri()==null) {
|
if (elementNamespace.getUri()==null) {
|
||||||
throw new NullPointerException("Can add ElementNamespaceContext without uri.");
|
throw new NullPointerException("Can add ElementNamespace without uri.");
|
||||||
}
|
}
|
||||||
logger.fine("Adding namespaceUri: "+elementNamespaceContext.getUri());
|
logger.fine("Adding namespaceUri: "+elementNamespace.getUri());
|
||||||
elementNamespaceContexts.put(elementNamespaceContext.getUri(), elementNamespaceContext);
|
elementNamespaces.put(elementNamespace.getUri(), elementNamespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContext(java.lang.String)
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespace(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ElementNamespaceContext getElementNamespaceContext(String namespaceUri) {
|
public ElementNamespace getElementNamespace(String namespaceUri) {
|
||||||
return elementNamespaceContexts.get(namespaceUri);
|
return elementNamespaces.get(namespaceUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaceContexts()
|
* @see org.x4o.xml.lang.X4OLanguageModule#getElementNamespaces()
|
||||||
*/
|
*/
|
||||||
public List<ElementNamespaceContext> getElementNamespaceContexts() {
|
public List<ElementNamespace> getElementNamespaces() {
|
||||||
return new ArrayList<ElementNamespaceContext>(elementNamespaceContexts.values());
|
return new ArrayList<ElementNamespace>(elementNamespaces.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,7 +252,7 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
|
||||||
elementAttributeHandlers.clear();
|
elementAttributeHandlers.clear();
|
||||||
elementBindingHandlers.clear();
|
elementBindingHandlers.clear();
|
||||||
elementInterfaces.clear();
|
elementInterfaces.clear();
|
||||||
elementNamespaceContexts.clear();
|
elementNamespaces.clear();
|
||||||
|
|
||||||
getLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
|
getLanguageModuleLoader().loadLanguageModule(elementLanguage, elementLanguageModule);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.x4o.xml.element.ElementAttributeValueParser;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
import org.x4o.xml.element.ElementObjectPropertyValue;
|
import org.x4o.xml.element.ElementObjectPropertyValue;
|
||||||
import org.x4o.xml.lang.phase.X4OPhaseException;
|
import org.x4o.xml.lang.phase.X4OPhaseException;
|
||||||
|
@ -157,7 +157,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
*/
|
*/
|
||||||
public Element createElementInstance(X4OLanguageContext context,Class<?> objectClass) {
|
public Element createElementInstance(X4OLanguageContext context,Class<?> objectClass) {
|
||||||
for (X4OLanguageModule modContext:getLanguageModules()) {
|
for (X4OLanguageModule modContext:getLanguageModules()) {
|
||||||
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
for (ElementNamespace nsContext:modContext.getElementNamespaces()) {
|
||||||
for (ElementClass ec:nsContext.getElementClasses()) {
|
for (ElementClass ec:nsContext.getElementClasses()) {
|
||||||
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
||||||
try {
|
try {
|
||||||
|
@ -253,15 +253,15 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.x4o.xml.lang.X4OLanguage#findElementNamespaceContext(java.lang.String)
|
* @see org.x4o.xml.lang.X4OLanguage#findElementNamespace(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public ElementNamespaceContext findElementNamespaceContext(String namespaceUri) {
|
public ElementNamespace findElementNamespace(String namespaceUri) {
|
||||||
|
|
||||||
// TODO: refactor so no search for every tag !!
|
// TODO: refactor so no search for every tag !!
|
||||||
ElementNamespaceContext result = null;
|
ElementNamespace result = null;
|
||||||
for (int i=0;i<elementLanguageModules.size();i++) {
|
for (int i=0;i<elementLanguageModules.size();i++) {
|
||||||
X4OLanguageModule module = elementLanguageModules.get(i);
|
X4OLanguageModule module = elementLanguageModules.get(i);
|
||||||
result = module.getElementNamespaceContext(namespaceUri);
|
result = module.getElementNamespace(namespaceUri);
|
||||||
if (result!=null) {
|
if (result!=null) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.x4o.xml.element.DefaultElementBodyWhitespace;
|
||||||
import org.x4o.xml.element.DefaultElementClass;
|
import org.x4o.xml.element.DefaultElementClass;
|
||||||
import org.x4o.xml.element.DefaultElementClassAttribute;
|
import org.x4o.xml.element.DefaultElementClassAttribute;
|
||||||
import org.x4o.xml.element.DefaultElementInterface;
|
import org.x4o.xml.element.DefaultElementInterface;
|
||||||
import org.x4o.xml.element.DefaultElementNamespaceContext;
|
import org.x4o.xml.element.DefaultElementNamespace;
|
||||||
import org.x4o.xml.element.DefaultElementNamespaceInstanceProvider;
|
import org.x4o.xml.element.DefaultElementNamespaceInstanceProvider;
|
||||||
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
||||||
import org.x4o.xml.element.DefaultGlobalAttributeHandlerComparator;
|
import org.x4o.xml.element.DefaultGlobalAttributeHandlerComparator;
|
||||||
|
@ -57,7 +57,7 @@ public class DefaultX4OLanguageConfiguration extends AbstractX4OLanguageConfigur
|
||||||
public void fillDefaults() {
|
public void fillDefaults() {
|
||||||
if (getLanguageResourcePathPrefix()==null) { setLanguageResourcePathPrefix( X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX); }
|
if (getLanguageResourcePathPrefix()==null) { setLanguageResourcePathPrefix( X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX); }
|
||||||
if (getLanguageResourceModulesFileName()==null) { setLanguageResourceModulesFileName( X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE);}
|
if (getLanguageResourceModulesFileName()==null) { setLanguageResourceModulesFileName( X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE);}
|
||||||
if (getDefaultElementNamespaceContext()==null) { setDefaultElementNamespaceContext( DefaultElementNamespaceContext.class); }
|
if (getDefaultElementNamespace()==null) { setDefaultElementNamespace( DefaultElementNamespace.class); }
|
||||||
if (getDefaultElementInterface()==null) { setDefaultElementInterface( DefaultElementInterface.class); }
|
if (getDefaultElementInterface()==null) { setDefaultElementInterface( DefaultElementInterface.class); }
|
||||||
if (getDefaultElement()==null) { setDefaultElement( DefaultElement.class); }
|
if (getDefaultElement()==null) { setDefaultElement( DefaultElement.class); }
|
||||||
if (getDefaultElementClass()==null) { setDefaultElementClass( DefaultElementClass.class); }
|
if (getDefaultElementClass()==null) { setDefaultElementClass( DefaultElementClass.class); }
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
||||||
import org.x4o.xml.element.Element;
|
import org.x4o.xml.element.Element;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.lang.phase.X4OPhaseManager;
|
import org.x4o.xml.lang.phase.X4OPhaseManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,9 +98,9 @@ public interface X4OLanguage {
|
||||||
/**
|
/**
|
||||||
* Returns the namespace context for an namespace uri.
|
* Returns the namespace context for an namespace uri.
|
||||||
* @param namespaceUri the namespace uri.
|
* @param namespaceUri the namespace uri.
|
||||||
* @return The ElementNamespaceContext.
|
* @return The ElementNamespace.
|
||||||
*/
|
*/
|
||||||
ElementNamespaceContext findElementNamespaceContext(String namespaceUri);
|
ElementNamespace findElementNamespace(String namespaceUri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns a list of element language modules in this defined and loaded language.
|
* @return Returns a list of element language modules in this defined and loaded language.
|
||||||
|
|
|
@ -47,7 +47,7 @@ public interface X4OLanguageConfiguration {
|
||||||
String getLanguageResourceModulesFileName();
|
String getLanguageResourceModulesFileName();
|
||||||
|
|
||||||
// Core interfaces are also in class for text reference without instance
|
// Core interfaces are also in class for text reference without instance
|
||||||
Class<?> getDefaultElementNamespaceContext();
|
Class<?> getDefaultElementNamespace();
|
||||||
Class<?> getDefaultElementInterface();
|
Class<?> getDefaultElementInterface();
|
||||||
Class<?> getDefaultElement();
|
Class<?> getDefaultElement();
|
||||||
Class<?> getDefaultElementClass();
|
Class<?> getDefaultElementClass();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public interface X4OLanguageConfigurationLocal extends X4OLanguageConfiguration
|
||||||
void setLanguageResourcePathPrefix(String value);
|
void setLanguageResourcePathPrefix(String value);
|
||||||
void setLanguageResourceModulesFileName(String value);
|
void setLanguageResourceModulesFileName(String value);
|
||||||
|
|
||||||
void setDefaultElementNamespaceContext(Class<?> value);
|
void setDefaultElementNamespace(Class<?> value);
|
||||||
void setDefaultElementInterface(Class<?> value);
|
void setDefaultElementInterface(Class<?> value);
|
||||||
void setDefaultElement(Class<?> value);
|
void setDefaultElement(Class<?> value);
|
||||||
void setDefaultElementClass(Class<?> value);
|
void setDefaultElementClass(Class<?> value);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementMetaBase;
|
import org.x4o.xml.element.ElementMetaBase;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ElementLanguageModule.<br>
|
* The ElementLanguageModule.<br>
|
||||||
|
@ -110,21 +110,21 @@ public interface X4OLanguageModule extends ElementMetaBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an namespace to this langauge module.
|
* Adds an namespace to this langauge module.
|
||||||
* @param elementNamespaceContext Adds an ElementNamespaceContext to this langauge module.
|
* @param elementNamespace Adds an ElementNamespace to this langauge module.
|
||||||
*/
|
*/
|
||||||
void addElementNamespaceContext(ElementNamespaceContext elementNamespaceContext);
|
void addElementNamespace(ElementNamespace elementNamespace);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the namespace context for an namespace uri.
|
* Returns the namespace context for an namespace uri.
|
||||||
* @param namespaceUri the namespace uri.
|
* @param namespaceUri the namespace uri.
|
||||||
* @return The ElementNamespaceContext.
|
* @return The ElementNamespace.
|
||||||
*/
|
*/
|
||||||
ElementNamespaceContext getElementNamespaceContext(String namespaceUri);
|
ElementNamespace getElementNamespace(String namespaceUri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns a list of all namespaces defined in this language.
|
* @return Returns a list of all namespaces defined in this language.
|
||||||
*/
|
*/
|
||||||
List<ElementNamespaceContext> getElementNamespaceContexts();
|
List<ElementNamespace> getElementNamespaces();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param elementLanguageModuleLoader Sets the loader of this module.
|
* @param elementLanguageModuleLoader Sets the loader of this module.
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.sax.X4ODebugWriter;
|
import org.x4o.xml.io.sax.X4ODebugWriter;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriter;
|
import org.x4o.xml.io.sax.ext.ContentWriter;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -767,7 +767,7 @@ public class X4OPhaseLanguageRead {
|
||||||
// note: slow version
|
// note: slow version
|
||||||
private String getNamespaceForElement(Element e) {
|
private String getNamespaceForElement(Element e) {
|
||||||
for (X4OLanguageModule mod:e.getLanguageContext().getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:e.getLanguageContext().getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext enc:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace enc:mod.getElementNamespaces()) {
|
||||||
List<ElementClass> l = enc.getElementClasses();
|
List<ElementClass> l = enc.getElementClasses();
|
||||||
if (l.contains(e.getElementClass())) {
|
if (l.contains(e.getElementClass())) {
|
||||||
return enc.getUri();
|
return enc.getUri();
|
||||||
|
@ -802,7 +802,7 @@ public class X4OPhaseLanguageRead {
|
||||||
}
|
}
|
||||||
|
|
||||||
String nameSpace = getNamespaceForElement(element);
|
String nameSpace = getNamespaceForElement(element);
|
||||||
String prefix = element.getLanguageContext().getLanguage().findElementNamespaceContext(nameSpace).getPrefixMapping();
|
String prefix = element.getLanguageContext().getLanguage().findElementNamespace(nameSpace).getPrefixMapping();
|
||||||
|
|
||||||
if (startedPrefix.contains(prefix)==false) {
|
if (startedPrefix.contains(prefix)==false) {
|
||||||
handler.startPrefixMapping(prefix, nameSpace);
|
handler.startPrefixMapping(prefix, nameSpace);
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandlerException;
|
import org.x4o.xml.element.ElementBindingHandlerException;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
import org.x4o.xml.element.ElementNamespaceInstanceProviderException;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.x4o.xml.lang.X4OLanguageContext;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
|
@ -133,7 +133,7 @@ public class X4OPhaseLanguageWrite {
|
||||||
private Element findRootElement(X4OLanguageContext languageContext,Class<?> objectClass) throws ElementNamespaceInstanceProviderException {
|
private Element findRootElement(X4OLanguageContext languageContext,Class<?> objectClass) throws ElementNamespaceInstanceProviderException {
|
||||||
// redo this mess, add nice find for root
|
// redo this mess, add nice find for root
|
||||||
for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
for (ElementNamespace nsContext:modContext.getElementNamespaces()) {
|
||||||
if (nsContext.getLanguageRoot()!=null && nsContext.getLanguageRoot()) {
|
if (nsContext.getLanguageRoot()!=null && nsContext.getLanguageRoot()) {
|
||||||
for (ElementClass ec:nsContext.getElementClasses()) {
|
for (ElementClass ec:nsContext.getElementClasses()) {
|
||||||
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
||||||
|
@ -144,7 +144,7 @@ public class X4OPhaseLanguageWrite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule modContext:languageContext.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
|
for (ElementNamespace nsContext:modContext.getElementNamespaces()) {
|
||||||
for (ElementClass ec:nsContext.getElementClasses()) {
|
for (ElementClass ec:nsContext.getElementClasses()) {
|
||||||
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
|
||||||
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getId());
|
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getId());
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<bindingHandler id="ElementModuleBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementModuleBindingHandler"/>
|
<bindingHandler id="ElementModuleBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementModuleBindingHandler"/>
|
||||||
<bindingHandler id="ElementClassAttributeBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementClassAttributeBindingHandler"/>
|
<bindingHandler id="ElementClassAttributeBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementClassAttributeBindingHandler"/>
|
||||||
<bindingHandler id="ElementInterfaceBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementInterfaceBindingHandler"/>
|
<bindingHandler id="ElementInterfaceBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementInterfaceBindingHandler"/>
|
||||||
<bindingHandler id="ElementNamespaceContextBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementNamespaceContextBindingHandler"/>
|
<bindingHandler id="ElementNamespaceBindingHandler" bean.class="org.x4o.xml.eld.lang.ElementNamespaceBindingHandler"/>
|
||||||
<bindingHandler id="StringSplitConverterBindingHandler" bean.class="org.x4o.xml.eld.lang.StringSplitConverterBindingHandler"/>
|
<bindingHandler id="StringSplitConverterBindingHandler" bean.class="org.x4o.xml.eld.lang.StringSplitConverterBindingHandler"/>
|
||||||
<bindingHandler id="StringSplitConverterStepBindingHandler" bean.class="org.x4o.xml.eld.lang.StringSplitConverterStepBindingHandler"/>
|
<bindingHandler id="StringSplitConverterStepBindingHandler" bean.class="org.x4o.xml.eld.lang.StringSplitConverterStepBindingHandler"/>
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
<description>Some basic language definitions and some helper tags.</description>
|
<description>Some basic language definitions and some helper tags.</description>
|
||||||
|
|
||||||
<!-- First copy some core elements over from parent config -->
|
<!-- First copy some core elements over from parent config -->
|
||||||
<element id="namespace" objectClass="${parentLanguage.languageConfiguration.defaultElementNamespaceContext}">
|
<element id="namespace" objectClass="${parentLanguage.languageConfiguration.defaultElementNamespace}">
|
||||||
<description>Defines an namespace for the language.</description>
|
<description>Defines an namespace for the language.</description>
|
||||||
<attribute id="id" required="true">
|
<attribute id="id" required="true">
|
||||||
<description>The namespace id.</description>
|
<description>The namespace id.</description>
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class EmptyXmlTest extends TestCase {
|
||||||
try {
|
try {
|
||||||
reader.readResource("tests/empty-xml/empty-test.xml");
|
reader.readResource("tests/empty-xml/empty-test.xml");
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
assertEquals("No ElementNamespaceContext found for empty namespace.", e.getMessage());
|
assertEquals("No ElementNamespace found for empty namespace.", e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assertEquals(true,false);
|
assertEquals(true,false);
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class EldParserTest extends TestCase {
|
||||||
try {
|
try {
|
||||||
//X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
|
//X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
|
||||||
//List<String> resultTags = new ArrayList<String>(50);
|
//List<String> resultTags = new ArrayList<String>(50);
|
||||||
//for (ElementNamespaceContext ns:module.getElementNamespaceContexts()) {
|
//for (ElementNamespace ns:module.getElementNamespaces()) {
|
||||||
//
|
//
|
||||||
//}
|
//}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<!--
|
<!--
|
||||||
<languageResourcePathPrefix>META-INF</languageResourcePathPrefix>
|
<languageResourcePathPrefix>META-INF</languageResourcePathPrefix>
|
||||||
<languageResourceModulesFileName>-modules.xml</languageResourceModulesFileName>
|
<languageResourceModulesFileName>-modules.xml</languageResourceModulesFileName>
|
||||||
<defaultElementNamespaceContext>org.x4o.xml.element.DefaultElementNamespaceContext</defaultElementNamespaceContext>
|
<defaultElementNamespace>org.x4o.xml.element.DefaultElementNamespace</defaultElementNamespace>
|
||||||
<defaultElementInterface>org.x4o.xml.element.DefaultElementInterface</defaultElementInterface>
|
<defaultElementInterface>org.x4o.xml.element.DefaultElementInterface</defaultElementInterface>
|
||||||
<defaultElement>org.x4o.xml.element.DefaultElement</defaultElement>
|
<defaultElement>org.x4o.xml.element.DefaultElement</defaultElement>
|
||||||
<defaultElementClass>org.x4o.xml.element.DefaultElementClass</defaultElementClass>
|
<defaultElementClass>org.x4o.xml.element.DefaultElementClass</defaultElementClass>
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
import org.x4o.xml.element.ElementConfiguratorGlobal;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementException;
|
import org.x4o.xml.element.ElementException;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.x4o.xml.lang.X4OLanguageContext;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -121,7 +121,7 @@ public class EldDocWriter {
|
||||||
doc.addTreeNodePageModeClass(X4OLanguageContext.class);
|
doc.addTreeNodePageModeClass(X4OLanguageContext.class);
|
||||||
doc.addTreeNodePageModeClass(X4OLanguageModule.class);
|
doc.addTreeNodePageModeClass(X4OLanguageModule.class);
|
||||||
doc.addTreeNodePageModeClass(ElementInterface.class);
|
doc.addTreeNodePageModeClass(ElementInterface.class);
|
||||||
doc.addTreeNodePageModeClass(ElementNamespaceContext.class);
|
doc.addTreeNodePageModeClass(ElementNamespace.class);
|
||||||
|
|
||||||
doc.addAnnotatedClasses(EldDocWriterLanguage.class);
|
doc.addAnnotatedClasses(EldDocWriterLanguage.class);
|
||||||
doc.addAnnotatedClasses(EldDocWriterLanguageModule.class);
|
doc.addAnnotatedClasses(EldDocWriterLanguageModule.class);
|
||||||
|
@ -132,7 +132,7 @@ public class EldDocWriter {
|
||||||
ApiDocConcept adcRoot = doc.addConcept(new ApiDocConcept(null,C_CONTEXT,X4OLanguageContext.class));
|
ApiDocConcept adcRoot = doc.addConcept(new ApiDocConcept(null,C_CONTEXT,X4OLanguageContext.class));
|
||||||
ApiDocConcept adcMod = doc.addConcept(new ApiDocConcept(adcRoot,C_MODULE,X4OLanguageModule.class));
|
ApiDocConcept adcMod = doc.addConcept(new ApiDocConcept(adcRoot,C_MODULE,X4OLanguageModule.class));
|
||||||
ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class));
|
ApiDocConcept adcIface = doc.addConcept(new ApiDocConcept(adcMod,C_INTERFACE,ElementInterface.class));
|
||||||
ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespaceContext.class));
|
ApiDocConcept adcNs = doc.addConcept(new ApiDocConcept(adcMod,C_NAMESPACE,ElementNamespace.class));
|
||||||
ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class));
|
ApiDocConcept adcEc = doc.addConcept(new ApiDocConcept(adcNs,C_ELEMENT,ElementClass.class));
|
||||||
|
|
||||||
// mm maybe redo something here
|
// mm maybe redo something here
|
||||||
|
@ -158,7 +158,7 @@ public class EldDocWriter {
|
||||||
for (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface));
|
for (ElementInterface iface:mod.getElementInterfaces()) { ApiDocNode ifaceNode = modNode.addNode(createNodeElementInterface(iface));
|
||||||
for (ElementClassAttribute eca:iface.getElementClassAttributes()) { ifaceNode.addNode(createNodeElementClassAttribute(eca)); }
|
for (ElementClassAttribute eca:iface.getElementClassAttributes()) { ifaceNode.addNode(createNodeElementClassAttribute(eca)); }
|
||||||
for (ElementConfigurator conf:iface.getElementConfigurators()) { ifaceNode.addNode(createNodeElementConfigurator(conf)); } }
|
for (ElementConfigurator conf:iface.getElementConfigurators()) { ifaceNode.addNode(createNodeElementConfigurator(conf)); } }
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespaceContext(ns));
|
for (ElementNamespace ns:mod.getElementNamespaces()) { ApiDocNode nsNode = modNode.addNode(createNodeElementNamespace(ns));
|
||||||
for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec));
|
for (ElementClass ec:ns.getElementClasses()) { ApiDocNode ecNode = nsNode.addNode(createNodeElementClass(ec));
|
||||||
for (ElementClassAttribute eca:ec.getElementClassAttributes()) { ecNode.addNode(createNodeElementClassAttribute(eca)); }
|
for (ElementClassAttribute eca:ec.getElementClassAttributes()) { ecNode.addNode(createNodeElementClassAttribute(eca)); }
|
||||||
for (ElementConfigurator conf:ec.getElementConfigurators()) { ecNode.addNode(createNodeElementConfigurator(conf)); } } }
|
for (ElementConfigurator conf:ec.getElementConfigurators()) { ecNode.addNode(createNodeElementConfigurator(conf)); } } }
|
||||||
|
@ -184,7 +184,7 @@ public class EldDocWriter {
|
||||||
private ApiDocNode createNodeElementInterface(ElementInterface iface) {
|
private ApiDocNode createNodeElementInterface(ElementInterface iface) {
|
||||||
return new ApiDocNode(iface,iface.getId(),iface.getId(),iface.getDescription());
|
return new ApiDocNode(iface,iface.getId(),iface.getId(),iface.getDescription());
|
||||||
}
|
}
|
||||||
private ApiDocNode createNodeElementNamespaceContext(ElementNamespaceContext ns) {
|
private ApiDocNode createNodeElementNamespace(ElementNamespace ns) {
|
||||||
return new ApiDocNode(ns,ns.getId(),ns.getUri(),ns.getDescription());
|
return new ApiDocNode(ns,ns.getId(),ns.getUri(),ns.getDescription());
|
||||||
}
|
}
|
||||||
private ApiDocNode createNodeElementClass(ElementClass ec) {
|
private ApiDocNode createNodeElementClass(ElementClass ec) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.eld.doc.api.dom.ApiDocWriteEvent;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterHtml.Tag;
|
import org.x4o.xml.io.sax.ext.ContentWriterHtml.Tag;
|
||||||
import org.x4o.xml.lang.X4OLanguageContext;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -111,7 +111,7 @@ public class EldDocWriterElementClass extends AbstractApiDocWriter {
|
||||||
public void writeElementRelationLinks(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
public void writeElementRelationLinks(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||||
ApiDocContentWriter writer = event.getWriter();
|
ApiDocContentWriter writer = event.getWriter();
|
||||||
ElementClass ec = (ElementClass)event.getEventObject().getUserData();
|
ElementClass ec = (ElementClass)event.getEventObject().getUserData();
|
||||||
ElementNamespaceContext ns = (ElementNamespaceContext)event.getEventObject().getParent().getUserData();
|
ElementNamespace ns = (ElementNamespace)event.getEventObject().getParent().getUserData();
|
||||||
X4OLanguageModule mod = (X4OLanguageModule)event.getEventObject().getParent().getParent().getUserData();
|
X4OLanguageModule mod = (X4OLanguageModule)event.getEventObject().getParent().getParent().getUserData();
|
||||||
X4OLanguageContext context = (X4OLanguageContext)event.getEventObject().getParent().getParent().getParent().getUserData();
|
X4OLanguageContext context = (X4OLanguageContext)event.getEventObject().getParent().getParent().getParent().getUserData();
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ public class EldDocWriterElementClass extends AbstractApiDocWriter {
|
||||||
writer.printTagEnd(Tag.dl);
|
writer.printTagEnd(Tag.dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toElementUri(String pathPrefix,X4OLanguageModule mod,ElementNamespaceContext namespace,ElementClass ec) {
|
private String toElementUri(String pathPrefix,X4OLanguageModule mod,ElementNamespace namespace,ElementClass ec) {
|
||||||
StringBuffer buf = new StringBuffer(100);
|
StringBuffer buf = new StringBuffer(100);
|
||||||
if (pathPrefix!=null) {
|
if (pathPrefix!=null) {
|
||||||
buf.append(pathPrefix);
|
buf.append(pathPrefix);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.x4o.xml.eld.doc.api.dom.ApiDocNodeBody;
|
||||||
import org.x4o.xml.eld.doc.api.dom.ApiDocNodeData;
|
import org.x4o.xml.eld.doc.api.dom.ApiDocNodeData;
|
||||||
import org.x4o.xml.eld.doc.api.dom.ApiDocWriteEvent;
|
import org.x4o.xml.eld.doc.api.dom.ApiDocWriteEvent;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,22 +42,22 @@ import org.xml.sax.SAXException;
|
||||||
*/
|
*/
|
||||||
public class EldDocWriterElementNamespace extends AbstractApiDocWriter {
|
public class EldDocWriterElementNamespace extends AbstractApiDocWriter {
|
||||||
|
|
||||||
@ApiDocNodeDataConfiguratorMethod(targetClasses={ElementNamespaceContext.class})
|
@ApiDocNodeDataConfiguratorMethod(targetClasses={ElementNamespace.class})
|
||||||
public void configNavBar(ApiDoc doc,ApiDocNode node,ApiDocNodeData data) {
|
public void configNavBar(ApiDoc doc,ApiDocNode node,ApiDocNodeData data) {
|
||||||
clearHrefContentGroup(doc,node,"summary","element",ElementClass.class);
|
clearHrefContentGroup(doc,node,"summary","element",ElementClass.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespaceContext.class},nodeBodyOrders={1},contentGroup="namespace",contentGroupType="summary")
|
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespace.class},nodeBodyOrders={1},contentGroup="namespace",contentGroupType="summary")
|
||||||
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
public void writeElementNamespaceBeanProperties(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||||
printApiTableBean(event,"Namespace","description","elementClasses","elementNamespaceInstanceProvider","prefixMapping");
|
printApiTableBean(event,"Namespace","description","elementClasses","elementNamespaceInstanceProvider","prefixMapping");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespaceContext.class},nodeBodyOrders={2},contentGroup="element",contentGroupType="summary")
|
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={ElementNamespace.class},nodeBodyOrders={2},contentGroup="element",contentGroupType="summary")
|
||||||
public void writeElementNamespaceElements(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
public void writeElementNamespaceElements(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||||
printApiTable(event,"Element Summary",ElementClass.class);
|
printApiTable(event,"Element Summary",ElementClass.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY_PAGE,targetClasses={ElementNamespaceContext.class},nodeBodyOrders={2})
|
//@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY_PAGE,targetClasses={ElementNamespace.class},nodeBodyOrders={2})
|
||||||
//public void writeElementNamespaceAttributes(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
//public void writeElementNamespaceAttributes(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||||
// printApiTable(event,"Element Summary",ElementClass.class);
|
// printApiTable(event,"Element Summary",ElementClass.class);
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.x4o.xml.eld.doc.api.dom.ApiDocWriteEvent;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClassAttribute;
|
import org.x4o.xml.element.ElementClassAttribute;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.lang.X4OLanguageContext;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -80,7 +80,7 @@ public class EldDocWriterLanguage extends AbstractApiDocWriter {
|
||||||
bindHandlers += mod.getElementBindingHandlers().size();
|
bindHandlers += mod.getElementBindingHandlers().size();
|
||||||
interFaces += mod.getElementInterfaces().size();
|
interFaces += mod.getElementInterfaces().size();
|
||||||
eleConfigs += mod.getElementConfiguratorGlobals().size();
|
eleConfigs += mod.getElementConfiguratorGlobals().size();
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
namespaces++;
|
namespaces++;
|
||||||
elements += ns.getElementClasses().size();
|
elements += ns.getElementClasses().size();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class EldDocWriterLanguage extends AbstractApiDocWriter {
|
||||||
writer.docTableStart("Namespace Summary", "All Language Namespaces Overview",ApiDocContentCss.overviewSummary);
|
writer.docTableStart("Namespace Summary", "All Language Namespaces Overview",ApiDocContentCss.overviewSummary);
|
||||||
writer.docTableHeader("ID", "URI");
|
writer.docTableHeader("ID", "URI");
|
||||||
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
writer.docTableRowLink("language/"+ApiDocContentWriter.toSafeUri(mod.getId())+"/"+ApiDocContentWriter.toSafeUri(ns.getId())+"/index.html",ns.getId(),ns.getUri());
|
writer.docTableRowLink("language/"+ApiDocContentWriter.toSafeUri(mod.getId())+"/"+ApiDocContentWriter.toSafeUri(ns.getId())+"/index.html",ns.getId(),ns.getUri());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.x4o.xml.element.ElementAttributeHandler;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementConfigurator;
|
import org.x4o.xml.element.ElementConfigurator;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class EldDocWriterLanguageModule extends AbstractApiDocWriter {
|
||||||
clearHrefContentGroup(doc,node,"summary","binding",ElementBindingHandler.class);
|
clearHrefContentGroup(doc,node,"summary","binding",ElementBindingHandler.class);
|
||||||
clearHrefContentGroup(doc,node,"summary","attribute",ElementAttributeHandler.class);
|
clearHrefContentGroup(doc,node,"summary","attribute",ElementAttributeHandler.class);
|
||||||
clearHrefContentGroup(doc,node,"summary","configurator",ElementConfigurator.class);
|
clearHrefContentGroup(doc,node,"summary","configurator",ElementConfigurator.class);
|
||||||
clearHrefContentGroup(doc,node,"summary","namespace",ElementNamespaceContext.class);
|
clearHrefContentGroup(doc,node,"summary","namespace",ElementNamespace.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={1},contentGroup="interface",contentGroupType="summary")
|
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={1},contentGroup="interface",contentGroupType="summary")
|
||||||
|
@ -77,6 +77,6 @@ public class EldDocWriterLanguageModule extends AbstractApiDocWriter {
|
||||||
|
|
||||||
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={5},contentGroup="namespace",contentGroupType="summary")
|
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={X4OLanguageModule.class},nodeBodyOrders={5},contentGroup="namespace",contentGroupType="summary")
|
||||||
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
public void writeNamespaceSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException {
|
||||||
printApiTable(event,"Namespace Summary",ElementNamespaceContext.class);
|
printApiTable(event,"Namespace Summary",ElementNamespace.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.eld.doc.api.dom.ApiDocWriteEvent;
|
||||||
import org.x4o.xml.element.ElementBindingHandler;
|
import org.x4o.xml.element.ElementBindingHandler;
|
||||||
import org.x4o.xml.element.ElementClass;
|
import org.x4o.xml.element.ElementClass;
|
||||||
import org.x4o.xml.element.ElementInterface;
|
import org.x4o.xml.element.ElementInterface;
|
||||||
import org.x4o.xml.element.ElementNamespaceContext;
|
import org.x4o.xml.element.ElementNamespace;
|
||||||
import org.x4o.xml.io.sax.ext.ContentWriterHtml.Tag;
|
import org.x4o.xml.io.sax.ext.ContentWriterHtml.Tag;
|
||||||
import org.x4o.xml.lang.X4OLanguageContext;
|
import org.x4o.xml.lang.X4OLanguageContext;
|
||||||
import org.x4o.xml.lang.X4OLanguageModule;
|
import org.x4o.xml.lang.X4OLanguageModule;
|
||||||
|
@ -88,7 +88,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
// temp print old way
|
// temp print old way
|
||||||
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
||||||
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
||||||
// found language root elements.
|
// found language root elements.
|
||||||
for (ElementClass ec:ns.getElementClasses()) {
|
for (ElementClass ec:ns.getElementClasses()) {
|
||||||
|
@ -107,7 +107,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
walkTree(rootNode,e.getWriter(),pathPrefix);
|
walkTree(rootNode,e.getWriter(),pathPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private String toElementUri(String pathPrefix,X4OLanguageModule mod,ElementNamespaceContext namespace,ElementClass ec) {
|
private String toElementUri(String pathPrefix,X4OLanguageModule mod,ElementNamespace namespace,ElementClass ec) {
|
||||||
StringBuffer buf = new StringBuffer(100);
|
StringBuffer buf = new StringBuffer(100);
|
||||||
if (pathPrefix!=null) {
|
if (pathPrefix!=null) {
|
||||||
buf.append(pathPrefix);
|
buf.append(pathPrefix);
|
||||||
|
@ -142,7 +142,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
|
|
||||||
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
List<TreeNode> rootNodes = new ArrayList<TreeNode>(3);
|
||||||
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
if (ns.getLanguageRoot()!=null && ns.getLanguageRoot()) {
|
||||||
// found language root elements.
|
// found language root elements.
|
||||||
for (ElementClass ec:ns.getElementClasses()) {
|
for (ElementClass ec:ns.getElementClasses()) {
|
||||||
|
@ -177,7 +177,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
class TreeNode {
|
class TreeNode {
|
||||||
X4OLanguageContext context;
|
X4OLanguageContext context;
|
||||||
X4OLanguageModule module;
|
X4OLanguageModule module;
|
||||||
ElementNamespaceContext namespace;
|
ElementNamespace namespace;
|
||||||
ElementClass elementClass;
|
ElementClass elementClass;
|
||||||
TreeNode parent;
|
TreeNode parent;
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
|
@ -190,7 +190,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
return result; // hard fail limit
|
return result; // hard fail limit
|
||||||
}
|
}
|
||||||
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
for (ElementClass ec:ns.getElementClasses()) {
|
for (ElementClass ec:ns.getElementClasses()) {
|
||||||
TreeNode n=null;
|
TreeNode n=null;
|
||||||
List<String> tags = ec.getElementParents(node.namespace.getUri());
|
List<String> tags = ec.getElementParents(node.namespace.getUri());
|
||||||
|
@ -262,7 +262,7 @@ public class EldDocXTreePageWriter extends DefaultPageWriterTree implements ApiD
|
||||||
List<TreeNode> result = new ArrayList<TreeNode>(10);
|
List<TreeNode> result = new ArrayList<TreeNode>(10);
|
||||||
TreeNode n=null;
|
TreeNode n=null;
|
||||||
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
for (X4OLanguageModule mod:node.context.getLanguage().getLanguageModules()) {
|
||||||
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
|
for (ElementNamespace ns:mod.getElementNamespaces()) {
|
||||||
|
|
||||||
List<String> tags = node.elementClass.getElementParents(ns.getUri());
|
List<String> tags = node.elementClass.getElementParents(ns.getUri());
|
||||||
if (tags!=null) {
|
if (tags!=null) {
|
||||||
|
|
Loading…
Reference in a new issue