Added providerHost in language module and remove name.

Added default uri/schemaUri/etc on namespace contexts.
Added default for id/tag of Element.
Added attribute aliases to xsd output.
Added name alias for id on namespace.
Added tag alias for id on element.
This commit is contained in:
Willem Cazander 2013-04-28 12:07:37 +02:00
parent d271edb1ee
commit 8f2408a207
33 changed files with 695 additions and 395 deletions

View file

@ -28,6 +28,7 @@ import java.util.logging.Logger;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.text.ClassConverter;
import org.x4o.xml.eld.lang.AttributeAliasElement;
import org.x4o.xml.eld.lang.BeanElement;
import org.x4o.xml.eld.lang.DescriptionElement;
import org.x4o.xml.eld.lang.ElementClassAddParentElement;
@ -61,8 +62,8 @@ import org.x4o.xml.lang.X4OLanguageModuleLoaderException;
public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
private Logger logger = null;
private static final String PP_CEL_PROVIDER = "cel.x4o.org";
private static final String PP_CEL_XMLNS = "http://"+PP_CEL_PROVIDER+"/xml/ns/";
private static final String PP_CEL_PROVIDER_HOST = "cel.x4o.org";
private static final String PP_CEL_XMLNS = "http://"+PP_CEL_PROVIDER_HOST+"/xml/ns/";
private static final String PP_CEL_XSD_FILE = "-1.0.xsd";
private static final String CEL_CORE = "cel-core";
private static final String CEL_ROOT = "cel-root";
@ -107,6 +108,8 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
ElementNamespaceContext 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.
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,"providerHost",true,null));
namespaceRoot.addElementClass(rootElement);
startAndAddNamespace(language,languageModule,namespaceRoot);
}
@ -121,6 +124,12 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
ElementClass ec = null;
namespace.addElementClass(createElementClass(language,"attribute",language.getLanguageConfiguration().getDefaultElementClassAttribute(),null,"Defines xml element attribute."));
ec = createElementClass(language,"attributeAlias",null,AttributeAliasElement.class,"Adds an attribute alias.");
ec.addElementClassAttribute(createElementClassAttribute(language,"name",true,null));
ec.addElementParent(CEL_CORE_URI, "attribute");
namespace.addElementClass(ec);
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.");
@ -184,10 +193,10 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
private void configLanguageModule(X4OLanguageModule languageModule) {
languageModule.setId("cel-module");
languageModule.setName("Core Element Languag Module");
languageModule.setProviderName(PP_CEL_PROVIDER);
languageModule.setProviderName("Core Element Languag Module");
languageModule.setProviderHost(PP_CEL_PROVIDER_HOST);
languageModule.setDescription("Core Element Language Module Loader");
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 {
@ -230,7 +239,7 @@ public class EldModuleLoaderCore implements X4OLanguageModuleLoader {
private ElementClass createElementClass(X4OLanguage language,String tag,Class<?> objectClass,Class<?> elementClass,String description) throws X4OLanguageModuleLoaderException {
try {
ElementClass result = (ElementClass)X4OLanguageClassLoader.newInstance(language.getLanguageConfiguration().getDefaultElementClass());
result.setTag(tag);
result.setId(tag);
result.setObjectClass(objectClass);
result.setElementClass(elementClass);
result.setDescription(description);

View file

@ -44,7 +44,7 @@ public class AttributeAliasElement extends AbstractElement {
public void doElementEnd() throws ElementException {
String alias = getAttributes().get("name");
if (alias==null) {
throw new ElementException("'name' attribute is not set on: "+getElementClass().getTag());
throw new ElementException("'name' attribute is not set on: "+getElementClass().getId());
}
if (getParent().getElementObject() instanceof ElementClassAttribute) {
((ElementClassAttribute)getParent().getElementObject()).addAttributeAlias(alias);

View file

@ -43,7 +43,7 @@ public class ElementClassAddParentElement extends AbstractElement {
public void doElementEnd() throws ElementException {
String tag = getAttributes().get("tag");
if (tag==null) {
throw new ElementException("'tag' attribute is not set on: "+getElementClass().getTag());
throw new ElementException("'tag' attribute is not set on: "+getElementClass().getId());
}
String namespaceUri = getAttributes().get("uri");
if (namespaceUri==null) {

View file

@ -100,6 +100,48 @@ public class ElementModuleBindingHandler extends AbstractElementBindingHandler<
}
if (childObject instanceof ElementNamespaceContext) {
ElementNamespaceContext elementNamespaceContext = (ElementNamespaceContext)childObject;
if (elementNamespaceContext.getId()==null) {
throw new NullPointerException("Can add ElementNamespaceContext without id.");
}
// TODO: no language here so move to EL default on eld attribute tag
if (elementNamespaceContext.getId()!=null) {
StringBuffer buf = new StringBuffer(30);
for (char c:elementNamespaceContext.getId().toLowerCase().toCharArray()) {
if (Character.isLetter(c)) {buf.append(c);}
if (Character.isDigit(c)) {buf.append(c);}
if ('-'==c) {buf.append(c);}
}
String id = buf.toString();
elementNamespaceContext.setId(id);
}
if (elementNamespaceContext.getUri()==null) {
elementNamespaceContext.setUri(
"http://"+languageModule.getProviderHost()+
"/xml/ns/"+x4oParsingContext.getLanguageName()+
"-"+elementNamespaceContext.getId());
}
if (elementNamespaceContext.getSchemaUri()==null) {
elementNamespaceContext.setSchemaUri(
"http://"+languageModule.getProviderHost()+
"/xml/ns/"+x4oParsingContext.getLanguageName()+
"-"+elementNamespaceContext.getId()+
"-"+x4oParsingContext.getLanguageVersion()+
".xsd"
);
}
if (elementNamespaceContext.getSchemaResource()==null) {
elementNamespaceContext.setSchemaResource(
x4oParsingContext.getLanguageName()+
"-"+elementNamespaceContext.getId()+
"-"+x4oParsingContext.getLanguageVersion()+
".xsd"
);
}
if (elementNamespaceContext.getSchemaPrefix()==null) {
elementNamespaceContext.setSchemaPrefix(elementNamespaceContext.getId());
}
try {
elementNamespaceContext.setElementNamespaceInstanceProvider((ElementNamespaceInstanceProvider)X4OLanguageClassLoader.newInstance(childElement.getLanguageContext().getLanguage().getLanguageConfiguration().getDefaultElementNamespaceInstanceProvider()));
} catch (Exception e) {

View file

@ -60,7 +60,11 @@ public class ElementNamespaceContextBindingHandler extends AbstractElementBindin
*/
public void bindChild(Element childElement,ElementNamespaceContext parent, Object childObject) throws ElementBindingHandlerException {
if (childObject instanceof ElementClass) {
parent.addElementClass((ElementClass)childObject);
ElementClass elementClass = (ElementClass)childObject;
if (elementClass.getId()==null && elementClass.getObjectClass()!=null) {
elementClass.setId(elementClass.getObjectClass().getSimpleName()); // TODO: move to defaults layer
}
parent.addElementClass(elementClass);
}
}

View file

@ -43,7 +43,7 @@ public class SkipPhaseElement extends AbstractElement {
public void doElementEnd() throws ElementException {
String phase = getAttributes().get("name");
if (phase==null) {
throw new ElementException("'name' attribute is not set on: "+getElementClass().getTag());
throw new ElementException("'name' attribute is not set on: "+getElementClass().getId());
}
if (getParent().getElementObject() instanceof ElementClass) {
((ElementClass)getParent().getElementObject()).addSkipPhase(phase);

View file

@ -38,7 +38,9 @@ import org.x4o.xml.element.ElementBindingHandler;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.element.ElementInterface;
import org.x4o.xml.element.ElementMetaBase;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.io.XMLConstants;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguage;
import org.xml.sax.SAXException;
@ -149,13 +151,11 @@ public class EldXsdXmlWriter {
public void startSchema(ElementNamespaceContext ns) throws SAXException {
xmlWriter.startDocument();
writeIgnorableWhitespace(XMLConstants.CHAR_NEWLINE);
writeComment(COMMENT_SEPERATOR);
writeIgnorableWhitespace(XMLConstants.CHAR_NEWLINE);
// this is a mess;
char[] msg;
msg = "\n".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
msg = COMMENT_SEPERATOR.toCharArray();
xmlWriter.comment(msg,0,msg.length);
String desc = "Automatic generated schema for language: "+language.getLanguageName();
int space = COMMENT_SEPERATOR.length()-desc.length()-(2*COMMENT_TEXT.length())-4;
StringBuffer b = new StringBuffer(COMMENT_SEPERATOR.length());
@ -168,17 +168,10 @@ public class EldXsdXmlWriter {
}
b.append(COMMENT_TEXT);
b.append(" ");
msg = "\n".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
msg = b.toString().toCharArray();
xmlWriter.comment(msg,0,msg.length);
msg = "\n".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
msg = COMMENT_SEPERATOR.toCharArray();
xmlWriter.comment(msg,0,msg.length);
msg = "\n".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
writeComment(b.toString());
writeIgnorableWhitespace(XMLConstants.CHAR_NEWLINE);
writeComment(COMMENT_SEPERATOR);
writeIgnorableWhitespace(XMLConstants.CHAR_NEWLINE);
X4OLanguageModule module = null;
for (X4OLanguageModule elm:language.getLanguageModules()) {
@ -190,19 +183,15 @@ public class EldXsdXmlWriter {
}
b = new StringBuffer(COMMENT_SEPERATOR.length());
b.append("\n\tProviderName:\t");
b.append(module.getProviderName());
b.append("\n\tModuleName:\t\t");
b.append(module.getName());
b.append("\n\tNamespaces:\t\t");
b.append(module.getElementNamespaceContexts().size());
b.append("\n\tNamespace:\t\t");
b.append(ns.getUri());
b.append("\n\tCreated on:\t\t");
b.append(new Date());
b.append("\n\tID:\t\t"); b.append(module.getId());
b.append("\n\tProviderName:\t"); b.append(module.getProviderName());
b.append("\n\tProviderHost:\t"); b.append(module.getProviderHost());
b.append("\n\tNamespaces:\t\t"); b.append(module.getElementNamespaceContexts().size());
b.append("\n\tUri:\t\t\t"); b.append(ns.getUri());
b.append("\n\tUri schema:\t"); b.append(ns.getSchemaUri());
b.append("\n\tCreated on:\t\t"); b.append(new Date());
b.append("\n");
msg = b.toString().toCharArray();
xmlWriter.comment(msg,0,msg.length);
writeComment(b.toString());
xmlWriter.startPrefixMapping("", SCHEMA_URI);
@ -234,6 +223,7 @@ public class EldXsdXmlWriter {
public void endSchema() throws SAXException {
xmlWriter.endElement (SCHEMA_URI, "schema" , "");
writeIgnorableWhitespace(XMLConstants.CHAR_NEWLINE);
xmlWriter.endDocument();
}
@ -241,13 +231,13 @@ public class EldXsdXmlWriter {
AttributesImpl atts = new AttributesImpl();
if (nsWrite.getLanguageRoot()!=null && nsWrite.getLanguageRoot()) {
atts.addAttribute ("", "name", "", "", ec.getTag());
atts.addAttribute ("", "name", "", "", ec.getId());
xmlWriter.startElement (SCHEMA_URI, "element", "", atts); // Only in the language root xsd there is an element.
atts = new AttributesImpl();
xmlWriter.startElement (SCHEMA_URI, "complexType", "", atts);
} else {
atts.addAttribute ("", "name", "", "", ec.getTag()+"Type");
atts.addAttribute ("", "name", "", "", ec.getId()+"Type");
xmlWriter.startElement (SCHEMA_URI, "complexType", "", atts);
}
@ -289,8 +279,15 @@ public class EldXsdXmlWriter {
if (eca.getRequired()!=null && eca.getRequired()) {
atts.addAttribute ("", "use", "", "", "required");
}
xmlWriter.startElement (SCHEMA_URI, "attribute", "", atts);
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
writeElementAttribute(eca,atts);
for (String alias:eca.getAttributeAliases()) {
attrNames.add(alias);
atts = new AttributesImpl();
atts.addAttribute ("", "name", "", "", alias);
atts.addAttribute ("", "type", "", "", "string");
writeElementAttribute(null,atts);
}
}
for (X4OLanguageModule mod:language.getLanguageModules()) {
@ -299,16 +296,13 @@ public class EldXsdXmlWriter {
atts = new AttributesImpl();
atts.addAttribute ("", "name", "", "", eah.getAttributeName());
atts.addAttribute ("", "type", "", "", "string");
xmlWriter.startElement (SCHEMA_URI, "attribute", "", atts);
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
writeElementAttribute(eah,atts);
}
}
if (ec.getAutoAttributes()!=null && ec.getAutoAttributes()==false) {
// oke, reverse this if and rm whitespace.
char[] msg;
msg = " ".toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
writeIgnorableWhitespace(" ");
} else {
@ -374,8 +368,8 @@ public class EldXsdXmlWriter {
List<String> refElements = new ArrayList<String>(20);
for (ElementClass checkClass:ns.getElementClasses()) {
List<String> parents = checkClass.getElementParents(nsWrite.getUri());
if (parents!=null && parents.contains(ecWrite.getTag())) {
refElements.add(checkClass.getTag());
if (parents!=null && parents.contains(ecWrite.getId())) {
refElements.add(checkClass.getId());
continue;
}
if (checkClass.getObjectClass()==null) {
@ -383,8 +377,8 @@ public class EldXsdXmlWriter {
}
for (ElementInterface ei:language.findElementInterfaces(checkClass.getObjectClass())) {
parents = ei.getElementParents(nsWrite.getUri());
if (parents!=null && parents.contains(ecWrite.getTag())) {
refElements.add(checkClass.getTag());
if (parents!=null && parents.contains(ecWrite.getId())) {
refElements.add(checkClass.getId());
break;
}
}
@ -395,7 +389,7 @@ public class EldXsdXmlWriter {
Class<?> checkObjectClass = checkClass.getObjectClass();
List<ElementBindingHandler> b = language.findElementBindingHandlers(objectClass,checkObjectClass);
if (b.isEmpty()==false) {
refElements.add(checkClass.getTag());
refElements.add(checkClass.getId());
}
}
@ -429,23 +423,57 @@ public class EldXsdXmlWriter {
return; // is done in writeElementClass
}
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "name", "", "", ec.getTag());
atts.addAttribute ("", "type", "", "", "this:"+ec.getTag()+"Type");
xmlWriter.startElement(SCHEMA_URI, "element", "", atts); // Only in the language root xsd there is an element.
atts.addAttribute ("", "name", "", "", ec.getId());
atts.addAttribute ("", "type", "", "", "this:"+ec.getId()+"Type");
xmlWriter.startElement(SCHEMA_URI, "element", "", atts);
writeElementMetaBase(ec);
xmlWriter.endElement(SCHEMA_URI, "element", "");
}
if (ec.getDescription()!=null) {
atts = new AttributesImpl();
private void writeElementAttribute(ElementMetaBase base,AttributesImpl atts) throws SAXException {
xmlWriter.startElement (SCHEMA_URI, "attribute", "", atts);
writeElementMetaBase(base);
xmlWriter.endElement(SCHEMA_URI, "attribute", "");
}
private void writeElementMetaBase(ElementMetaBase base) throws SAXException {
if (base==null) {
return;
}
if (base.getDescription()==null) {
return;
}
AttributesImpl atts = new AttributesImpl();
xmlWriter.startElement(SCHEMA_URI, "annotation", "", atts);
atts = new AttributesImpl();
atts.addAttribute ("", "xml:lang", "", "", "en");
xmlWriter.startElement(SCHEMA_URI, "documentation", "", atts);
char[] msg = ec.getDescription().toCharArray();
xmlWriter.characters(msg,0,msg.length);
writeCharacters(base.getDescription());
xmlWriter.endElement(SCHEMA_URI, "documentation", "");
xmlWriter.endElement(SCHEMA_URI, "annotation", "");
}
private void writeCharacters(String text) throws SAXException {
if (text==null) {
return;
}
char[] msg = text.toCharArray();
xmlWriter.characters(msg,0,msg.length);
}
xmlWriter.endElement(SCHEMA_URI, "element", "");
private void writeComment(String text) throws SAXException {
if (text==null) {
return;
}
char[] msg = text.toCharArray();
xmlWriter.comment(msg,0,msg.length);
}
private void writeIgnorableWhitespace(String text) throws SAXException {
if (text==null) {
return;
}
char[] msg = text.toCharArray();
xmlWriter.ignorableWhitespace(msg,0,msg.length);
}
}

View file

@ -34,7 +34,6 @@ import java.util.List;
*/
public abstract class AbstractElementClass extends AbstractElementClassBase implements ElementClass {
private String tag = null;
private Class<?> objectClass = null;
private Class<?> elementClass = null;
private Boolean autoAttributes = true;
@ -47,20 +46,6 @@ public abstract class AbstractElementClass extends AbstractElementClassBase impl
skipPhases = new ArrayList<String>(3);
}
/**
* @see ElementClass#getTag()
*/
public String getTag() {
return tag;
}
/**
* @see ElementClass#setTag(String)
*/
public void setTag(String tag) {
this.tag = tag;
}
/**
* @see ElementClass#getElementClass()
*/

View file

@ -81,10 +81,10 @@ public abstract class AbstractElementNamespaceContext extends AbstractElementMet
* @see org.x4o.xml.element.ElementNamespaceContext#addElementClass(org.x4o.xml.element.ElementClass)
*/
public void addElementClass(ElementClass elementClass) {
if (elementClass.getTag()==null) {
throw new NullPointerException("ElementClass not correctly configured getTag is null.");
if (elementClass.getId()==null) {
throw new NullPointerException("ElementClass not correctly configured getId is null.");
}
elementClasses.put(elementClass.getTag(), elementClass);
elementClasses.put(elementClass.getId(), elementClass);
}
/**

View file

@ -34,18 +34,6 @@ import java.util.List;
*/
public interface ElementClass extends ElementClassBase {
/**
* Gets the xml tag the Element should handle.
* @return the tag
*/
String getTag();
/**
* Sets the XML tag the Element should handle.
* @param tag the tag to set
*/
void setTag(String tag);
/**
* Gets the ElementClass.
* @return the elementClass

View file

@ -171,17 +171,17 @@ public class DefaultX4OWriter<T> extends AbstractX4OWriter<T> {
}
String elementUri = findElementUri(element);
writer.startElement(elementUri, element.getElementClass().getTag(), "", atts);
writer.startElement(elementUri, element.getElementClass().getId(), "", atts);
for (Element e:element.getChilderen()) {
writeTree(writer,e);
}
writer.endElement(elementUri, element.getElementClass().getTag(), "");
writer.endElement(elementUri, element.getElementClass().getId(), "");
}
private String findElementUri(Element e) {
for (X4OLanguageModule mod:getLanguageContext().getLanguage().getLanguageModules()) {
for (ElementNamespaceContext c:mod.getElementNamespaceContexts()) {
ElementClass ec = c.getElementClass(e.getElementClass().getTag());
ElementClass ec = c.getElementClass(e.getElementClass().getId());
if (ec!=null) {
return c.getUri();
}

View file

@ -220,8 +220,9 @@ public class X4ODebugWriter {
for (X4OLanguageModule module:elementLanguage.getLanguage().getLanguageModules()) {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "className", "", "", module.getClass().getName());
atts.addAttribute ("", "name", "", "", module.getName());
atts.addAttribute ("", "id", "", "", module.getId());
atts.addAttribute ("", "providerName", "", "", module.getProviderName());
atts.addAttribute ("", "providerHost", "", "", module.getProviderHost());
if (module.getLanguageModuleLoader()==null) {
atts.addAttribute ("", "elementLanguageModuleLoaderClassName", "", "", "null");
} else {
@ -366,12 +367,12 @@ public class X4ODebugWriter {
private StringBuffer getElementPath(Element element,StringBuffer buff) {
if (element.getParent()==null) {
buff.append('/'); // root slash
buff.append(element.getElementClass().getTag());
buff.append(element.getElementClass().getId());
return buff;
}
buff = getElementPath(element.getParent(),buff);
buff.append('/');
buff.append(element.getElementClass().getTag());
buff.append(element.getElementClass().getId());
return buff;
}
@ -435,7 +436,9 @@ public class X4ODebugWriter {
private void debugElementClass(ElementClass elementClass) throws SAXException {
AttributesImpl atts = new AttributesImpl();
atts.addAttribute ("", "tag", "", "", elementClass.getTag());
atts.addAttribute ("", "id", "", "", elementClass.getId());
atts.addAttribute ("", "autoAttributes", "", "", ""+elementClass.getAutoAttributes());
//atts.addAttribute ("", "schemaContentBase", "", "", ""+elementClass.getSchemaContentBase());
atts.addAttribute ("", "description", "", "", elementClass.getDescription());
atts.addAttribute ("", "objectClassName", "", "", ""+elementClass.getObjectClass());
atts.addAttribute ("", "className", "", "", elementClass.getClass().getName());

View file

@ -182,7 +182,7 @@ public class X4OTagHandler extends DefaultHandler2 {
logger.finest("XMLTAG-END: "+namespaceUri+":"+tag);
}
if (overrideSaxHandler!=null) {
if (overrideSaxElement.getElementClass().getTag().equals(tag)) {
if (overrideSaxElement.getElementClass().getId().equals(tag)) {
overrideSaxHandler.endDocument();
overrideSaxHandler = null;
overrideSaxElement = null; // elementStack code make sure doElementEnd is runned on override element.
@ -229,7 +229,7 @@ public class X4OTagHandler extends DefaultHandler2 {
try {
e.doCharacters(text);
} catch (ElementException ee) {
throw new SAXParseException("Error while doCharacters element: '"+e.getElementClass().getTag()+"' "+ee.getMessage(),locator,ee);
throw new SAXParseException("Error while doCharacters element: '"+e.getElementClass().getId()+"' "+ee.getMessage(),locator,ee);
}
}
@ -254,7 +254,7 @@ public class X4OTagHandler extends DefaultHandler2 {
try {
e.doIgnorableWhitespace(text);
} catch (ElementException ee) {
throw new SAXParseException("Error while doIgnorableWhitespace element: '"+e.getElementClass().getTag()+"' "+ee.getMessage(),locator,ee);
throw new SAXParseException("Error while doIgnorableWhitespace element: '"+e.getElementClass().getId()+"' "+ee.getMessage(),locator,ee);
}
}
@ -279,7 +279,7 @@ public class X4OTagHandler extends DefaultHandler2 {
try {
e.doComment(text);
} catch (ElementException ee) {
throw new SAXParseException("Error while doComment element: '"+e.getElementClass().getTag()+"' "+ee.getMessage(),locator,ee);
throw new SAXParseException("Error while doComment element: '"+e.getElementClass().getId()+"' "+ee.getMessage(),locator,ee);
}
}

View file

@ -45,23 +45,15 @@ import org.x4o.xml.element.ElementNamespaceContext;
public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase implements X4OLanguageModule {
private Logger logger = null;
private String name=null;
private String providerName=null;
private String providerHost=null;
private String sourceResource = null;
/** The globalAttribute handlers */
private List<ElementAttributeHandler> elementAttributeHandlers = null;
/** The binding rules */
private List<ElementBindingHandler> elementBindingHandlers = null;
private List<ElementConfiguratorGlobal> elementConfiguratorGlobals = null;
private List<ElementInterface> elementInterfaces = null;
private Map<String,ElementNamespaceContext> elementNamespaceContexts = null;
private X4OLanguageModuleLoader elementLanguageModuleLoader = null;
/**
@ -77,20 +69,6 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
elementNamespaceContexts = new HashMap<String,ElementNamespaceContext>(10);
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the providerName
*/
@ -105,6 +83,20 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
this.providerName = providerName;
}
/**
* @return the providerHost
*/
public String getProviderHost() {
return providerHost;
}
/**
* @param providerHost the providerHost to set
*/
public void setProviderHost(String providerHost) {
this.providerHost = providerHost;
}
/**
* @see org.x4o.xml.lang.X4OLanguageModule#addElementAttributeHandler(ElementAttributeHandler)
*/
@ -208,20 +200,6 @@ public abstract class AbstractX4OLanguageModule extends AbstractElementMetaBase
if (elementNamespaceContext.getUri()==null) {
throw new NullPointerException("Can add ElementNamespaceContext without uri.");
}
if (elementNamespaceContext.getId()==null) {
StringBuffer buf = new StringBuffer(30);
for (char c:elementNamespaceContext.getUri().toLowerCase().toCharArray()) {
if (Character.isLetter(c)) {buf.append(c);}
if (Character.isDigit(c)) {buf.append(c);}
}
String id = buf.toString();
if (id.startsWith("http")) {id = id.substring(4);}
elementNamespaceContext.setId(id);
}
// TODO: no language here so move to EL default on eld attribute tag
//if (elementNamespaceContext.getSchemaUri()==null) {
// elementNamespaceContext.setSchemaUri(elementNamespaceContext.getUri()+elementNamespaceContext.)
//}
logger.fine("Adding namespaceUri: "+elementNamespaceContext.getUri());
elementNamespaceContexts.put(elementNamespaceContext.getUri(), elementNamespaceContext);
}

View file

@ -140,7 +140,7 @@ public class DefaultX4OLanguage implements X4OLanguageLocal {
for (ElementClass ec:nsContext.getElementClasses()) {
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
try {
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(context, ec.getTag());
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(context, ec.getId());
} catch (ElementNamespaceInstanceProviderException e) {
throw new RuntimeException(e.getMessage(),e); // TODO: fix me
}

View file

@ -41,16 +41,6 @@ import org.x4o.xml.element.ElementNamespaceContext;
*/
public interface X4OLanguageModule extends ElementMetaBase {
/**
* @return the Name.
*/
String getName();
/**
* @param name the module name to set.
*/
void setName(String name);
/**
* @return the providerName.
*/
@ -61,6 +51,16 @@ public interface X4OLanguageModule extends ElementMetaBase {
*/
void setProviderName(String providerName);
/**
* @return the providerHost
*/
public String getProviderHost();
/**
* @param providerHost the providerHost to set
*/
public void setProviderHost(String providerHost);
/**
* Adds an ElementAttributeHandler.
* @param elementAttributeHandler Adds an ElmentAttributeHandler.

View file

@ -981,11 +981,11 @@ public class X4OPhaseLanguageRead {
handler.startPrefixMapping(prefix, nameSpace);
startedPrefix.add(prefix);
}
handler.startElement (nameSpace, element.getElementClass().getTag(), "", atts);
handler.startElement (nameSpace, element.getElementClass().getId(), "", atts);
for (Element e:element.getAllChilderen()) {
printXML(e);
}
handler.endElement (nameSpace, element.getElementClass().getTag(), "");
handler.endElement (nameSpace, element.getElementClass().getId(), "");
}
};
return result;

View file

@ -144,7 +144,7 @@ public class X4OPhaseLanguageWrite {
if (nsContext.getLanguageRoot()!=null && nsContext.getLanguageRoot()) {
for (ElementClass ec:nsContext.getElementClasses()) {
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getTag());
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getId());
}
}
}
@ -154,7 +154,7 @@ public class X4OPhaseLanguageWrite {
for (ElementNamespaceContext nsContext:modContext.getElementNamespaceContexts()) {
for (ElementClass ec:nsContext.getElementClasses()) {
if (ec.getObjectClass()!=null && ec.getObjectClass().equals(objectClass)) {
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getTag());
return nsContext.getElementNamespaceInstanceProvider().createElementInstance(languageContext, ec.getId());
}
}
}

View file

@ -3,11 +3,12 @@
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
ProviderName: cel.x4o.org
ModuleName: Core Element Languag Module
ID: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Namespace: http://cel.x4o.org/xml/ns/cel-core
Created on: Sat Apr 27 20:01:59 CEST 2013
Created on: Sun Apr 28 11:41:33 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://cel.x4o.org/xml/ns/cel-core"
@ -19,8 +20,8 @@
</choice>
<attribute name="uri" type="string" use="required"/>
<attribute name="name" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="elementNamespaceInstanceProvider" type="string"/>
<attribute name="schemaUri" type="string"/>
<attribute name="schemaResource" type="string"/>
@ -44,7 +45,6 @@
</choice>
<attribute name="objectClass" type="string"/>
<attribute name="elementClass" type="string"/>
<attribute name="tag" type="string"/>
<attribute name="schemaContentComplex" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="schemaContentBase" type="string"/>
@ -60,6 +60,11 @@
<attribute name="configAction" type="string"/>
<anyAttribute/>
</complexType>
<complexType name="attributeAliasType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="name" type="string" use="required"/>
<anyAttribute/>
</complexType>
<complexType name="configuratorType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
@ -77,17 +82,18 @@
</complexType>
<complexType name="attributeType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="attributeAlias" type="this:attributeAliasType"/>
<element name="classConverter" type="this:classConverterType"/>
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="name" type="string"/>
<attribute name="required" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runBeanValue" type="boolean"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="writeOrder" type="integer"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="required" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="description" type="string"/>
<attribute name="id" type="string"/>
</complexType>
@ -144,6 +150,12 @@
</documentation>
</annotation>
</element>
<element name="attributeAlias" type="this:attributeAliasType">
<annotation>
<documentation xml:lang="en">Adds an attribute alias.
</documentation>
</annotation>
</element>
<element name="configurator" type="this:configuratorType">
<annotation>
<documentation xml:lang="en">Define generic configurator for language.

View file

@ -3,11 +3,12 @@
<!-- ===== Automatic generated schema for language: cel ===== -->
<!-- ==================================================================== -->
<!--
ProviderName: cel.x4o.org
ModuleName: Core Element Languag Module
ID: cel-module
ProviderName: Core Element Languag Module
ProviderHost: cel.x4o.org
Namespaces: 2
Namespace: http://cel.x4o.org/xml/ns/cel-root
Created on: Sat Apr 27 20:01:59 CEST 2013
Created on: Sun Apr 28 11:41:33 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cel-core="http://cel.x4o.org/xml/ns/cel-core"
@ -23,12 +24,12 @@
<element ref="cel-core:elementInterface"/>
<element ref="cel-core:namespace"/>
</choice>
<attribute name="name" type="string"/>
<attribute name="id" type="string" use="required"/>
<attribute name="providerHost" type="string" use="required"/>
<attribute name="sourceResource" type="string"/>
<attribute name="languageModuleLoader" type="string"/>
<attribute name="providerName" type="string"/>
<attribute name="description" type="string"/>
<attribute name="id" type="string"/>
</complexType>
</element>
</schema>

View file

@ -3,11 +3,13 @@
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ProviderName: eld.x4o.org
ModuleName: Element Language Definition
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-conv
Created on: Sat Apr 27 20:06:33 CEST 2013
Uri: http://eld.x4o.org/xml/ns/eld-conv
Uri schema: http://eld.x4o.org/xml/ns/eld-conv-0.8.xsd
Created on: Sun Apr 28 11:56:32 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://eld.x4o.org/xml/ns/eld-conv"
@ -25,7 +27,12 @@
</complexType>
<complexType name="beanConverterType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="bean.class" type="string"/>
<attribute name="bean.class" type="string">
<annotation>
<documentation xml:lang="en">The class name of the converter to load.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="stringSplitConverterStepType">
@ -42,10 +49,30 @@
<element name="stringSplitConverter" type="this:stringSplitConverterType"/>
<element name="urlConverter" type="this:urlConverterType"/>
</choice>
<attribute name="toMethod" type="string"/>
<attribute name="fromOrder" type="string" use="required"/>
<attribute name="fromMethod" type="string" use="required"/>
<attribute name="toOrder" type="string" use="required"/>
<attribute name="toMethod" type="string">
<annotation>
<documentation xml:lang="en">The convert 'to' method step.
</documentation>
</annotation>
</attribute>
<attribute name="fromOrder" type="string" use="required">
<annotation>
<documentation xml:lang="en">The convert 'from' order.
</documentation>
</annotation>
</attribute>
<attribute name="fromMethod" type="string" use="required">
<annotation>
<documentation xml:lang="en">The convert 'from' method step.
</documentation>
</annotation>
</attribute>
<attribute name="toOrder" type="string" use="required">
<annotation>
<documentation xml:lang="en">The convert 'to' order.
</documentation>
</annotation>
</attribute>
<attribute name="objectConverter" type="string"/>
</complexType>
<complexType name="doubleConverterType">
@ -61,11 +88,36 @@
<choice minOccurs="0" maxOccurs="unbounded">
<element name="stringSplitConverterStep" type="this:stringSplitConverterStepType"/>
</choice>
<attribute name="useNativeType" type="string"/>
<attribute name="singleToMethod" type="string"/>
<attribute name="splitSize" type="string" use="required"/>
<attribute name="split" type="string" use="required"/>
<attribute name="classTo" type="string" use="required"/>
<attribute name="useNativeType" type="string">
<annotation>
<documentation xml:lang="en">Set to true to convert to native data type.
</documentation>
</annotation>
</attribute>
<attribute name="singleToMethod" type="string">
<annotation>
<documentation xml:lang="en">Shortcut to use only this method for the 'to' convert.
</documentation>
</annotation>
</attribute>
<attribute name="splitSize" type="string" use="required">
<annotation>
<documentation xml:lang="en">The split value expected size.
</documentation>
</annotation>
</attribute>
<attribute name="split" type="string" use="required">
<annotation>
<documentation xml:lang="en">The split regex.
</documentation>
</annotation>
</attribute>
<attribute name="classTo" type="string" use="required">
<annotation>
<documentation xml:lang="en">The class name to convert the string to.
</documentation>
</annotation>
</attribute>
</complexType>
<complexType name="integerConverterType">
<choice minOccurs="0" maxOccurs="unbounded"/>

View file

@ -3,11 +3,13 @@
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ProviderName: eld.x4o.org
ModuleName: Element Language Definition
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-lang
Created on: Sat Apr 27 20:06:33 CEST 2013
Uri: http://eld.x4o.org/xml/ns/eld-lang
Uri schema: http://eld.x4o.org/xml/ns/eld-lang-0.8.xsd
Created on: Sun Apr 28 11:56:32 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
@ -19,15 +21,20 @@
<element name="description" type="this:descriptionType"/>
<element name="element" type="this:elementType"/>
</choice>
<attribute name="uri" type="string" use="required"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The namespace id.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="elementNamespaceInstanceProvider" type="string"/>
<attribute name="uri" type="string"/>
<attribute name="schemaUri" type="string"/>
<attribute name="schemaResource" type="string"/>
<attribute name="schemaPrefix" type="string"/>
<attribute name="id" type="string"/>
<attribute name="prefixMapping" type="string"/>
<attribute name="languageRoot" type="boolean"/>
<attribute name="description" type="string"/>
</complexType>
<complexType name="descriptionType">
@ -39,7 +46,12 @@
</complexType>
<complexType name="elementSkipPhaseType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="name" type="string" use="required"/>
<attribute name="name" type="string" use="required">
<annotation>
<documentation xml:lang="en">The name of the phase to skip.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="elementType">
@ -52,60 +64,145 @@
<element name="elementParent" type="this:elementParentType"/>
<element name="elementSkipPhase" type="this:elementSkipPhaseType"/>
</choice>
<attribute name="objectClass" type="string"/>
<attribute name="elementClass" type="string"/>
<attribute name="id" type="string">
<annotation>
<documentation xml:lang="en">The attribute id. (with tag as alias)
</documentation>
</annotation>
</attribute>
<attribute name="tag" type="string"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="objectClass" type="string">
<annotation>
<documentation xml:lang="en">The class of the wrapped object.
</documentation>
</annotation>
</attribute>
<attribute name="elementClass" type="string">
<annotation>
<documentation xml:lang="en">An custom element class to config object.
</documentation>
</annotation>
</attribute>
<attribute name="schemaContentComplex" type="boolean"/>
<attribute name="autoAttributes" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/>
<attribute name="schemaContentBase" type="string"/>
<attribute name="id" type="string"/>
<attribute name="description" type="string"/>
</complexType>
<complexType name="attributeAliasType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="name" type="string" use="required"/>
<attribute name="name" type="string" use="required">
<annotation>
<documentation xml:lang="en">The alias name to add to the attribute.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="configuratorGlobalType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="bean.class" type="string" use="required"/>
<attribute name="configAction" type="string"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The global element configurator id.
</documentation>
</annotation>
</attribute>
<attribute name="bean.class" type="string" use="required">
<annotation>
<documentation xml:lang="en">The class of the element configurator.
</documentation>
</annotation>
</attribute>
<attribute name="configAction" type="string">
<annotation>
<documentation xml:lang="en">If set to true then run in config phase.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="configuratorType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="bean.class" type="string" use="required"/>
<attribute name="configAction" type="string"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The element configurator id.
</documentation>
</annotation>
</attribute>
<attribute name="bean.class" type="string" use="required">
<annotation>
<documentation xml:lang="en">The class of the global element configurator.
</documentation>
</annotation>
</attribute>
<attribute name="configAction" type="string">
<annotation>
<documentation xml:lang="en">If set to true then run in config phase.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="attributeFromBodyType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="bodyType" type="string"/>
<attribute name="id" type="string" use="required"/>
<attribute name="name" type="string" use="required"/>
<attribute name="bodyType" type="string">
<annotation>
<documentation xml:lang="en">See org.x4o.xml.element.Element.ElementType for options defaults to 'characters'.
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The id for this configurator.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation xml:lang="en">The attribute name to fill the value.
</documentation>
</annotation>
</attribute>
</complexType>
<complexType name="attributeHandlerType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="attributeHandlerNextAttribute" type="this:attributeHandlerNextAttributeType"/>
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="attributeName" type="string" use="required"/>
<attribute name="id" type="string" use="required"/>
<attribute name="bean.class" type="string" use="required"/>
<attribute name="attributeName" type="string" use="required">
<annotation>
<documentation xml:lang="en">The xml attribute name.
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The atttribute handler id.
</documentation>
</annotation>
</attribute>
<attribute name="bean.class" type="string" use="required">
<annotation>
<documentation xml:lang="en">The class of the attribute handler.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="attributeHandlerNextAttributeType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="attributeName" type="string" use="required"/>
<attribute name="attributeName" type="string" use="required">
<annotation>
<documentation xml:lang="en">The attribute name to run after this attribute.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="attributeType">
@ -126,41 +223,86 @@
<element name="bean" type="this:beanType"/>
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="id" type="string">
<annotation>
<documentation xml:lang="en">The attribute id. (with name as alias)
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string"/>
<attribute name="defaultValue" type="string"/>
<attribute name="required" type="boolean"/>
<attribute name="writeOrder" type="integer"/>
<attribute name="runBeanValue" type="boolean"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="objectConverter" type="string"/>
<attribute name="id" type="string"/>
<attribute name="runBeanValue" type="boolean"/>
<attribute name="writeOrder" type="integer"/>
<attribute name="runConverters" type="boolean"/>
<attribute name="runResolveEL" type="boolean"/>
<attribute name="description" type="string"/>
</complexType>
<complexType name="bindingHandlerType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="bean.class" type="string" use="required"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The binding handler id.
</documentation>
</annotation>
</attribute>
<attribute name="bean.class" type="string" use="required">
<annotation>
<documentation xml:lang="en">The class of the binding handler.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="beanType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="attributeHandlerNextAttribute" type="this:attributeHandlerNextAttributeType"/>
</choice>
<attribute name="bean.class" type="string"/>
<attribute name="bean.class" type="string">
<annotation>
<documentation xml:lang="en">The class name of the the class to load.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<complexType name="classBindingHandlerType">
<choice minOccurs="0" maxOccurs="unbounded">
<element name="description" type="this:descriptionType"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="childClass" type="string" use="required"/>
<attribute name="parentClass" type="string" use="required"/>
<attribute name="getMethod" type="string" use="required"/>
<attribute name="addMethod" type="string" use="required"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The id for this binding handler.
</documentation>
</annotation>
</attribute>
<attribute name="childClass" type="string" use="required">
<annotation>
<documentation xml:lang="en">The child class.
</documentation>
</annotation>
</attribute>
<attribute name="parentClass" type="string" use="required">
<annotation>
<documentation xml:lang="en">The parent class.
</documentation>
</annotation>
</attribute>
<attribute name="getMethod" type="string" use="required">
<annotation>
<documentation xml:lang="en">The method name of the method used to get the childeren of the parent.
</documentation>
</annotation>
</attribute>
<attribute name="addMethod" type="string" use="required">
<annotation>
<documentation xml:lang="en">The method name of the method used to add the child to the parent.
</documentation>
</annotation>
</attribute>
</complexType>
<complexType name="elementInterfaceType">
<choice minOccurs="0" maxOccurs="unbounded">
@ -173,14 +315,34 @@
<element name="description" type="this:descriptionType"/>
<element name="elementParent" type="this:elementParentType"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="interfaceClass" type="string" use="required"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The interface id.
</documentation>
</annotation>
</attribute>
<attribute name="interfaceClass" type="string" use="required">
<annotation>
<documentation xml:lang="en">The interface class.
</documentation>
</annotation>
</attribute>
<attribute name="description" type="string"/>
</complexType>
<complexType name="elementParentType">
<choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="tag" type="string"/>
<attribute name="uri" type="string"/>
<attribute name="tag" type="string">
<annotation>
<documentation xml:lang="en">The parent tag to have object for.
</documentation>
</annotation>
</attribute>
<attribute name="uri" type="string">
<annotation>
<documentation xml:lang="en">The element namespace uri if non local parent.
</documentation>
</annotation>
</attribute>
<anyAttribute/>
</complexType>
<element name="namespace" type="this:namespaceType">

View file

@ -28,8 +28,8 @@
xmlns="http://cel.x4o.org/xml/ns/cel-core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cel.x4o.org/xml/ns/cel-root http://cel.x4o.org/xml/ns/cel-root-1.0.xsd"
name="Element Language Definition"
providerName="eld.x4o.org"
providerName="Element Language Definition"
providerHost="eld.x4o.org"
id="eld-module"
>
<description>The full element language definition(eld) which is used to define xml languages.</description>
@ -52,11 +52,17 @@
id="eld-root"
>
<description>Single root namespace so xsd schema generation works correct.</description>
<element tag="module" objectClass="${parentLanguageConfiguration.defaultElementLanguageModule}" elementClass="org.x4o.xml.eld.lang.ModuleElement">
<element id="module" objectClass="${parentLanguageConfiguration.defaultElementLanguageModule}" elementClass="org.x4o.xml.eld.lang.ModuleElement">
<description>The module root element.</description>
<attribute id="id" required="true">
<description>The module id.</description>
</attribute>
<description>The module root element.</description>
<attribute id="providerHost" required="true">
<description>The provider host like langx.someorg.domain for uri/etc defaults.</description>
</attribute>
<attribute id="providerName">
<description>The provider name in normal en:lang.</description>
</attribute>
</element>
</namespace>
@ -71,14 +77,18 @@
<description>Some basic language definitions and some helper tags.</description>
<!-- First copy some core elements over from parent config -->
<element tag="namespace" objectClass="${parentLanguageConfiguration.defaultElementNamespaceContext}">
<element id="namespace" objectClass="${parentLanguageConfiguration.defaultElementNamespaceContext}">
<description>Defines an namespace for the language.</description>
<attribute id="uri" required="true">
<attribute id="id" required="true">
<description>The namespace id.</description>
</attribute>
</element>
<element tag="element" objectClass="${parentLanguageConfiguration.defaultElementClass}">
<element id="element" objectClass="${parentLanguageConfiguration.defaultElementClass}">
<description>The xml element.</description>
<attribute id="id">
<attributeAlias name="tag"/>
<description>The attribute id. (with tag as alias)</description>
</attribute>
<attribute id="objectClass">
<description>The class of the wrapped object.</description>
<classConverter/>
@ -88,7 +98,7 @@
<classConverter/>
</attribute>
</element>
<element tag="elementInterface" objectClass="${parentLanguageConfiguration.defaultElementInterface}">
<element id="elementInterface" objectClass="${parentLanguageConfiguration.defaultElementInterface}">
<description>Config element objects by java interface.</description>
<attribute id="id" required="true">
<description>The interface id.</description>
@ -98,13 +108,17 @@
<classConverter/>
</attribute>
</element>
<element tag="attribute" objectClass="${parentLanguageConfiguration.defaultElementClassAttribute}">
<element id="attribute" objectClass="${parentLanguageConfiguration.defaultElementClassAttribute}">
<description>XML Element Attribute tag.</description>
<attribute id="id">
<attributeAlias name="name"/>
<description>The attribute id. (with name as alias)</description>
</attribute>
</element>
<!-- Create some support elements to make language readable. -->
<element tag="bindingHandler" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="bindingHandler" elementClass="org.x4o.xml.eld.lang.BeanElement">
<description>Define an className in bean.class for an ElementBindingHandler interface.</description>
<attribute id="id" required="true">
<description>The binding handler id.</description>
@ -116,7 +130,7 @@
<elementParent tag="elementInterface"/>
</element>
<element tag="attributeHandler" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="attributeHandler" elementClass="org.x4o.xml.eld.lang.BeanElement">
<description>Define an className in bean.class for an ElementAttributeHandler.</description>
<attribute id="id" required="true">
<description>The atttribute handler id.</description>
@ -130,7 +144,7 @@
<elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/>
</element>
<element tag="configuratorGlobal" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="configuratorGlobal" elementClass="org.x4o.xml.eld.lang.BeanElement">
<description>Define an className in bean.class for an ElementConfiguratorGlobal.</description>
<attribute id="id" required="true">
<description>The global element configurator id.</description>
@ -144,7 +158,7 @@
<elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/>
</element>
<element tag="configurator" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="configurator" elementClass="org.x4o.xml.eld.lang.BeanElement">
<description>Define an className in bean.class for an ElementConfigurator.</description>
<attribute id="id" required="true">
<description>The element configurator id.</description>
@ -159,7 +173,7 @@
<elementParent tag="element"/>
</element>
<element tag="description" elementClass="org.x4o.xml.eld.lang.DescriptionElement" schemaContentBase="string">
<element id="description" elementClass="org.x4o.xml.eld.lang.DescriptionElement" schemaContentBase="string">
<description>An ELD elementDescription field which lets you type text like this one in xml characters instead of an attribute.</description>
<elementParent tag="module" uri="http://eld.x4o.org/xml/ns/eld-root"/>
<elementParent tag="namespace"/>
@ -177,7 +191,7 @@
<!-- Add some special tags which do actions. -->
<element tag="elementParent" elementClass="org.x4o.xml.eld.lang.ElementClassAddParentElement">
<element id="elementParent" elementClass="org.x4o.xml.eld.lang.ElementClassAddParentElement">
<description>Adds an parent element tag for xsd</description>
<elementParent tag="element"/>
<elementParent tag="elementInterface"/>
@ -189,7 +203,7 @@
</attribute>
</element>
<element tag="elementSkipPhase" elementClass="org.x4o.xml.eld.lang.SkipPhaseElement">
<element id="elementSkipPhase" elementClass="org.x4o.xml.eld.lang.SkipPhaseElement">
<description>Adds an phase to skip to the parent element.</description>
<attribute id="name" required="true">
<description>The name of the phase to skip.</description>
@ -197,7 +211,7 @@
<elementParent tag="element"/>
</element>
<element tag="attributeHandlerNextAttribute" elementClass="org.x4o.xml.eld.lang.NextAttributeElement">
<element id="attributeHandlerNextAttribute" elementClass="org.x4o.xml.eld.lang.NextAttributeElement">
<description>Defines the parameter order.</description>
<attribute id="attributeName" required="true">
<description>The attribute name to run after this attribute.</description>
@ -206,7 +220,7 @@
<elementParent tag="bean"/>
</element>
<element tag="attributeAlias" elementClass="org.x4o.xml.eld.lang.AttributeAliasElement">
<element id="attributeAlias" elementClass="org.x4o.xml.eld.lang.AttributeAliasElement">
<description>Defines an alias for an attribute name.</description>
<attribute id="name" required="true">
<description>The alias name to add to the attribute.</description>
@ -214,7 +228,7 @@
<elementParent tag="attribute"/>
</element>
<element tag="attributeFromBody" objectClass="org.x4o.xml.eld.lang.AttributeFromBodyConfigurator" autoAttributes="false">
<element id="attributeFromBody" objectClass="org.x4o.xml.eld.lang.AttributeFromBodyConfigurator" autoAttributes="false">
<description>Defines an alias for an attribute name.</description>
<attribute id="id" required="true">
<description>The id for this configurator.</description>
@ -227,7 +241,7 @@
</attribute>
</element>
<element tag="classBindingHandler" objectClass="org.x4o.xml.eld.lang.ElementRefectionBindingHandler"
<element id="classBindingHandler" objectClass="org.x4o.xml.eld.lang.ElementRefectionBindingHandler"
autoAttributes="false"
>
<description>Lets you dynamicly bind to object togecher.</description>
@ -253,7 +267,7 @@
<!-- Config some helper elements -->
<!-- Helper elements for eld -->
<element tag="bean" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="bean" elementClass="org.x4o.xml.eld.lang.BeanElement">
<!-- BIG NOTE: maybe beanElement most go to meta to have clean impl. -->
<description>Loads bean into the Element</description>
<attribute id="bean.class">
@ -276,7 +290,7 @@
>
<description>Basic set of attribute value converters.</description>
<element tag="beanConverter" elementClass="org.x4o.xml.eld.lang.BeanElement">
<element id="beanConverter" elementClass="org.x4o.xml.eld.lang.BeanElement">
<description>Define an loadable in bean.class for an ObjectConverter.</description>
<attribute id="bean.class">
<description>The class name of the converter to load.</description>
@ -284,18 +298,18 @@
<elementParent tag="attribute" uri="http://eld.x4o.org/xml/ns/eld-lang"/>
<!-- todo: make converter which loads converter so xsd is correct. -->
</element>
<element tag="booleanConverter" objectClass="org.x4o.xml.conv.text.BooleanConverter" />
<element tag="byteConverter" objectClass="org.x4o.xml.conv.text.ByteConverter" />
<element tag="characterConverter" objectClass="org.x4o.xml.conv.text.CharacterConverter" />
<element tag="doubleConverter" objectClass="org.x4o.xml.conv.text.DoubleConverter" />
<element tag="floatConverter" objectClass="org.x4o.xml.conv.text.FloatConverter" />
<element tag="integerConverter" objectClass="org.x4o.xml.conv.text.IntegerConverter" />
<element tag="longConverter" objectClass="org.x4o.xml.conv.text.LongConverter" />
<element tag="urlConverter" objectClass="org.x4o.xml.conv.text.URLConverter" />
<element tag="classConverter" objectClass="org.x4o.xml.conv.text.ClassConverter" />
<element tag="enumConverter" objectClass="org.x4o.xml.conv.text.EnumConverter" />
<element id="booleanConverter" objectClass="org.x4o.xml.conv.text.BooleanConverter" />
<element id="byteConverter" objectClass="org.x4o.xml.conv.text.ByteConverter" />
<element id="characterConverter" objectClass="org.x4o.xml.conv.text.CharacterConverter" />
<element id="doubleConverter" objectClass="org.x4o.xml.conv.text.DoubleConverter" />
<element id="floatConverter" objectClass="org.x4o.xml.conv.text.FloatConverter" />
<element id="integerConverter" objectClass="org.x4o.xml.conv.text.IntegerConverter" />
<element id="longConverter" objectClass="org.x4o.xml.conv.text.LongConverter" />
<element id="urlConverter" objectClass="org.x4o.xml.conv.text.URLConverter" />
<element id="classConverter" objectClass="org.x4o.xml.conv.text.ClassConverter" />
<element id="enumConverter" objectClass="org.x4o.xml.conv.text.EnumConverter" />
<element tag="stringSplitConverter" objectClass="org.x4o.xml.conv.text.StringSplitConverter">
<element id="stringSplitConverter" objectClass="org.x4o.xml.conv.text.StringSplitConverter">
<attribute id="classTo" required="true">
<description>The class name to convert the string to.</description>
<classConverter/>
@ -305,7 +319,7 @@
<attribute id="singleToMethod" description="Shortcut to use only this method for the 'to' convert."/>
<attribute id="useNativeType" description="Set to true to convert to native data type."/>
</element>
<element tag="stringSplitConverterStep" objectClass="org.x4o.xml.conv.text.StringSplitConverterStep">
<element id="stringSplitConverterStep" objectClass="org.x4o.xml.conv.text.StringSplitConverterStep">
<attribute id="fromMethod" required="true" description="The convert 'from' method step."/>
<attribute id="toMethod" required="false" description="The convert 'to' method step."/>
<attribute id="fromOrder" required="true" description="The convert 'from' order."/>

View file

@ -3,11 +3,13 @@
<!-- ===== Automatic generated schema for language: eld ===== -->
<!-- ==================================================================== -->
<!--
ProviderName: eld.x4o.org
ModuleName: Element Language Definition
ID: eld-module
ProviderName: Element Language Definition
ProviderHost: eld.x4o.org
Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-root
Created on: Sat Apr 27 20:06:33 CEST 2013
Uri: http://eld.x4o.org/xml/ns/eld-root
Uri schema: http://eld.x4o.org/xml/ns/eld-root-1.0.xsd
Created on: Sun Apr 28 11:56:32 CEST 2013
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
@ -27,11 +29,26 @@
<element ref="lang:elementInterface"/>
<element ref="lang:namespace"/>
</choice>
<attribute name="id" type="string" use="required"/>
<attribute name="name" type="string"/>
<attribute name="providerName" type="string"/>
<attribute name="sourceResource" type="string"/>
<attribute name="id" type="string" use="required">
<annotation>
<documentation xml:lang="en">The module id.
</documentation>
</annotation>
</attribute>
<attribute name="providerName" type="string">
<annotation>
<documentation xml:lang="en">The provider name in normal en:lang.
</documentation>
</annotation>
</attribute>
<attribute name="providerHost" type="string" use="required">
<annotation>
<documentation xml:lang="en">The provider host like langx.someorg.domain for uri/etc defaults.
</documentation>
</annotation>
</attribute>
<attribute name="languageModuleLoader" type="string"/>
<attribute name="sourceResource" type="string"/>
<attribute name="description" type="string"/>
</complexType>
</element>

View file

@ -63,6 +63,8 @@ public class X4OWriterTest extends TestCase {
writer.writeFile(root, outputFile);
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
outputFile.delete();
//System.out.println("Output: '\n"+text+"\n' end in "+outputFile.getAbsolutePath());
assertTrue(text.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"));
assertTrue(text.contains("http://test.x4o.org/xml/ns/test-root"));
@ -71,10 +73,6 @@ public class X4OWriterTest extends TestCase {
assertTrue(text.contains("privateIntegerTypeField=\"123\""));
assertTrue(text.contains("privateDoubleObjectField=\"123.45\""));
assertTrue(text.contains("privateStringObjectField=\"x4o\""));
//System.out.println("Output: '\n"+text+"\n' end in "+outputFile.getAbsolutePath());
outputFile.delete();
}
public void testWriterSwiXmlOutput() throws Exception {

View file

@ -29,8 +29,8 @@
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="swixml2.test.x4o.org"
name="Swixml2 Language"
providerHost="swixml2.test.x4o.org"
providerName="Swixml2 Language"
id="swixml2-module"
>
@ -88,25 +88,12 @@
</elementInterface>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-root"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-root-2.0.xsd"
schemaResource="swixml-root-2.0.xsd"
schemaPrefix="sx-root"
name="Root element"
languageRoot="true"
id="sx-root"
>
<!-- Single element in language root to create nice tree, for imports in xsd namespace aware generated files. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
<namespace id="root" languageRoot="true">
<element tag="frame" objectClass="javax.swing.JFrame">
<description>Single element in language root to create nice tree, for imports in xsd namespace aware generated files.</description>
</element>
</namespace>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-lang"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-lang-2.0.xsd"
schemaResource="swixml-lang-2.0.xsd"
schemaPrefix="sx-lang"
id="sx-lang"
>
<namespace id="lang">
<!-- Note frame should not be here(it can but xsd needs root), but else classic xml does not parse without xmlns additions. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
<element tag="menubar" objectClass="javax.swing.JMenuBar"/>

View file

@ -29,8 +29,8 @@
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="swixml3.test.x4o.org"
name="Swixml3 Language"
providerHost="swixml.x4o.org"
providerName="Swixml3 Language"
id="swixml3-module"
>
@ -84,28 +84,13 @@
</attribute>
</elementInterface>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-root"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-root-3.0.xsd"
schemaResource="swixml-root-3.0.xsd"
schemaPrefix="sx-root"
name="Root element"
languageRoot="true"
id="sx-root"
>
<element tag="JFrame" objectClass="javax.swing.JFrame"/>
<namespace id="root" languageRoot="true">
<element objectClass="javax.swing.JFrame"/>
</namespace>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-lang"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-lang-3.0.xsd"
schemaResource="swixml-lang-3.0.xsd"
schemaPrefix="sx-lang"
id="sx-lang"
>
<element tag="JMenubar" objectClass="javax.swing.JMenuBar"/>
<element tag="JMenu" objectClass="javax.swing.JMenu"/>
<element tag="JMenuItem" objectClass="javax.swing.JMenuItem">
<namespace id="lang">
<element objectClass="javax.swing.JMenuBar"/>
<element objectClass="javax.swing.JMenu"/>
<element objectClass="javax.swing.JMenuItem">
<attribute id="accelerator">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/>
@ -114,9 +99,9 @@
<attribute id="Action" runBeanValue="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element>
<element tag="JMenu.Separator" />
<element tag="JPanel" objectClass="javax.swing.JPanel"/>
<element tag="JSplitPane" objectClass="javax.swing.JSplitPane">
<element id="JMenu.Separator" description="TODO"/>
<element objectClass="javax.swing.JPanel"/>
<element objectClass="javax.swing.JSplitPane">
<attribute id="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute>
@ -125,16 +110,16 @@
</attribute>
</element>
<element tag="JLayeredPane" objectClass="javax.swing.JLayeredPane"/>
<element tag="JRootPane" objectClass="javax.swing.JRootPane"/>
<element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="JTree" objectClass="javax.swing.JTree"/>
<element tag="JButton" objectClass="javax.swing.JButton"/>
<element tag="JTable" objectClass="javax.swing.JTable"/>
<element tag="JTextArea" objectClass="javax.swing.JTextArea"/>
<element tag="JLabel" objectClass="javax.swing.JLabel"/>
<element tag="JTextField" objectClass="javax.swing.JTextField"/>
<element tag="JDesktopPane" objectClass="javax.swing.JDesktopPane"/>
<element tag="JInternalFrame" objectClass="javax.swing.JInternalFrame"/>
<element objectClass="javax.swing.JLayeredPane"/>
<element objectClass="javax.swing.JRootPane"/>
<element objectClass="javax.swing.JScrollPane"/>
<element objectClass="javax.swing.JTree"/>
<element objectClass="javax.swing.JButton"/>
<element objectClass="javax.swing.JTable"/>
<element objectClass="javax.swing.JTextArea"/>
<element objectClass="javax.swing.JLabel"/>
<element objectClass="javax.swing.JTextField"/>
<element objectClass="javax.swing.JDesktopPane"/>
<element objectClass="javax.swing.JInternalFrame"/>
</namespace>
</root:module>

View file

@ -29,8 +29,8 @@
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="test.x4o.org"
name="Test Language"
providerName="test Language"
providerHost="test.x4o.org"
id="test-module"
>

View file

@ -29,6 +29,34 @@
xsi:schemaLocation="http://language.x4o.org/xml/ns/drivers http://language.x4o.org/xml/ns/drivers-1.0.xsd"
>
<driver language="test" className="org.x4o.xml.test.TestDriver"/>
<!--
<languageResourcePathPrefix>META-INF</languageResourcePathPrefix>
<languageResourceModulesFileName>-modules.xml</languageResourceModulesFileName>
<defaultElementNamespaceContext>org.x4o.xml.element.DefaultElementNamespaceContext</defaultElementNamespaceContext>
<defaultElementInterface>org.x4o.xml.element.DefaultElementInterface</defaultElementInterface>
<defaultElement>org.x4o.xml.element.DefaultElement</defaultElement>
<defaultElementClass>org.x4o.xml.element.DefaultElementClass</defaultElementClass>
<defaultElementClassAttribute></defaultElementClassAttribute>
<defaultElementLanguageModule></defaultElementLanguageModule>
<defaultElementBodyComment></defaultElementBodyComment>
<defaultElementBodyCharacters></defaultElementBodyCharacters>
<defaultElementBodyWhitespace></defaultElementBodyWhitespace>
<defaultElementNamespaceInstanceProvider></defaultElementNamespaceInstanceProvider>
<defaultElementAttributeValueParser></defaultElementAttributeValueParser>
<defaultElementObjectPropertyValue></defaultElementObjectPropertyValue>
<defaultElementAttributeHandlerComparator></defaultElementAttributeHandlerComparator>
<properties>
<property key="" value=""/>
</properties>
<lockLanguage>true</lockLanguage>
<secure-resources>
<secure-resource resource="META-INF/test/test-modules.xml" hash="887486557" hashType="MD5"/>
<secure-resource resource="META-INF/test/test-lang.eld" hash="238758509486557" hashType="MD5"/>
</secure-resources>
</driver>
-->
<driver language="swixml" className="org.x4o.xml.test.swixml.SwiXmlDriver"/>
<defaultDriver language="junit-defp"/>
</drivers>

View file

@ -30,7 +30,7 @@
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-root test-root-1.0.xsd"
name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3"
>
<JMenubar name="menubar">
<JMenuBar name="menubar">
<JMenu name="filemenu" text="File">
<JMenuItem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
<JMenuItem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
@ -45,7 +45,7 @@
<JMenu text="Help">
<JMenuItem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
</JMenu>
</JMenubar>
</JMenuBar>
<JDesktopPane>
<JInternalFrame title="Flow Layout (right aligned)" bounds="10,10,150,150" layout="FlowLayout(FlowLayout.RIGHT)" visible="true" resizable="true">
<JButton text="1"/>

View file

@ -191,7 +191,7 @@ public class EldDocHtmlWriter {
List<X4OLanguageModule> mods = context.getLanguage().getLanguageModules();
Collections.sort(mods,new ElementLanguageModuleComparator());
for (X4OLanguageModule mod:mods) {
printTableRowOverview(pw,toSafeUri(mod.getId())+"/index.html",mod.getId(),mod.getName());
printTableRowOverview(pw,toSafeUri(mod.getId())+"/index.html",mod.getId(),mod.getDescription());
}
printTableEnd(pw);
printBottom(pw,"");
@ -279,11 +279,11 @@ public class EldDocHtmlWriter {
pw.print("/");
pw.print(toSafeUri(node.namespace.getId()));
pw.print("/");
pw.print(toSafeUri(node.elementClass.getTag()));
pw.print(toSafeUri(node.elementClass.getId()));
pw.print("/index.html\">");
pw.print(node.namespace.getId());
pw.print(":");
pw.print(node.elementClass.getTag());
pw.print(node.elementClass.getId());
pw.print("</a><br/>\n");
List<TreeNode> childs = findChilderen(node);
@ -303,7 +303,7 @@ public class EldDocHtmlWriter {
for (ElementClass ec:ns.getElementClasses()) {
TreeNode n=null;
List<String> tags = ec.getElementParents(node.namespace.getUri());
if (tags!=null && tags.contains(node.elementClass.getTag())) {
if (tags!=null && tags.contains(node.elementClass.getId())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
@ -318,7 +318,7 @@ public class EldDocHtmlWriter {
// Check interfaces of parent , and see if child tag is there.
for (ElementInterface ei:node.context.getLanguage().findElementInterfaces(ec.getObjectClass())) {
List<String> eiTags = ei.getElementParents(node.namespace.getUri());
if (eiTags!=null && eiTags.contains(node.elementClass.getTag())) {
if (eiTags!=null && eiTags.contains(node.elementClass.getId())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
@ -357,7 +357,7 @@ public class EldDocHtmlWriter {
private boolean isInTree(TreeNode node,TreeNode checkNode) {
if ( node.namespace.getUri().equals(checkNode.namespace.getUri()) &&
node.elementClass.getTag().equals(checkNode.elementClass.getTag())
node.elementClass.getId().equals(checkNode.elementClass.getId())
) {
return true;
}
@ -376,7 +376,7 @@ public class EldDocHtmlWriter {
List<String> tags = node.elementClass.getElementParents(ns.getUri());
if (tags!=null) {
for (ElementClass ec:ns.getElementClasses()) {
if (tags.contains(ec.getTag())) {
if (tags.contains(ec.getId())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
@ -394,7 +394,7 @@ public class EldDocHtmlWriter {
if (node.elementClass.getObjectClass()!=null) {
for (ElementInterface ei:node.context.getLanguage().findElementInterfaces(node.elementClass.getObjectClass())) {
List<String> eiTags = ei.getElementParents(ns.getUri());
if (eiTags!=null && eiTags.contains(ec.getTag())) {
if (eiTags!=null && eiTags.contains(ec.getId())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
@ -439,7 +439,7 @@ public class EldDocHtmlWriter {
String pathPrefix = "../";
try {
printHeader(pw,"Overview ("+mod.getId()+")",pathPrefix);
printPageTitle(pw,"Module",mod.getName(),mod.getDescription());
printPageTitle(pw,"Module",mod.getProviderName(),mod.getDescription());
String pathPrefixModule = pathPrefix+toSafeUri(mod.getId())+"/";
@ -469,7 +469,7 @@ public class EldDocHtmlWriter {
List<ElementClass> ecs = ns.getElementClasses();
Collections.sort(ecs,new ElementClassComparator());
for (ElementClass ec:ecs) {
printTableRowOverview(pw,toSafeUri(ec.getTag())+"/index.html",ec.getTag(),ec.getDescription());
printTableRowOverview(pw,toSafeUri(ec.getId())+"/index.html",ec.getId(),ec.getDescription());
}
printTableEnd(pw);
printBottom(pw,pathPrefix);
@ -496,11 +496,11 @@ public class EldDocHtmlWriter {
public void writeElement(File basePath,ElementClass ec,ElementNamespaceContext ns,X4OLanguageModule mod,X4OLanguageContext context) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"index.html");
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getId(),"index.html");
String pathPrefix = "../../../";
try {
printHeader(pw,"Tag ("+ec.getTag()+")",pathPrefix);
printPageTitle(pw,"Tag",ec.getTag(),ec.getDescription());
printHeader(pw,"Tag ("+ec.getId()+")",pathPrefix);
printPageTitle(pw,"Tag",ec.getId(),ec.getDescription());
TreeNode node = new TreeNode();
node.context=context;
@ -522,11 +522,11 @@ public class EldDocHtmlWriter {
pw.print("/");
pw.print(toSafeUri(n.namespace.getId()));
pw.print("/");
pw.print(toSafeUri(n.elementClass.getTag()));
pw.print(toSafeUri(n.elementClass.getId()));
pw.print("/index.html\">");
pw.print(n.namespace.getId());
pw.print(":");
pw.print(n.elementClass.getTag());
pw.print(n.elementClass.getId());
pw.print("</a>\n");
}
pw.print("</td>\n");
@ -547,11 +547,11 @@ public class EldDocHtmlWriter {
pw.print("/");
pw.print(toSafeUri(n.namespace.getId()));
pw.print("/");
pw.print(toSafeUri(n.elementClass.getTag()));
pw.print(toSafeUri(n.elementClass.getId()));
pw.print("/index.html\">");
pw.print(n.namespace.getId());
pw.print(":");
pw.print(n.elementClass.getTag());
pw.print(n.elementClass.getId());
pw.print("</a>\n");
}
pw.print("</td>\n");
@ -561,7 +561,6 @@ public class EldDocHtmlWriter {
printTableStart(pw,"Element Properties");
printTableRowSummary(pw,"id",""+ec.getId());
printTableRowSummary(pw,"tag",""+ec.getTag());
printTableRowSummary(pw,"objectClass",""+ec.getObjectClass());
printTableRowSummary(pw,"elementClass",""+ec.getElementClass());
printTableRowSummary(pw,"autoAttributes",""+ec.getAutoAttributes());
@ -640,7 +639,7 @@ public class EldDocHtmlWriter {
}
public void writeElementConfigurator(File basePath,ElementConfigurator conf,X4OLanguageModule mod,ElementNamespaceContext ns,ElementClass ec) throws IOException {
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getTag(),"conf",conf.getId()+".html");
PrintWriter pw = createPrintWriter(basePath,mod.getId(),ns.getId(),ec.getId(),"conf",conf.getId()+".html");
String pathPrefix = "../../../../";
try {
printHeader(pw,"Interface Configurator ("+conf.getId()+")",pathPrefix);
@ -1036,13 +1035,13 @@ public class EldDocHtmlWriter {
class TreeNodeComparator implements Comparator<TreeNode> {
public int compare(TreeNode o1,TreeNode o2) {
return o1.elementClass.getTag().compareTo(o2.elementClass.getTag());
return o1.elementClass.getId().compareTo(o2.elementClass.getId());
}
}
class ElementClassComparator implements Comparator<ElementClass> {
public int compare(ElementClass o1,ElementClass o2) {
return o1.getTag().compareTo(o2.getTag());
return o1.getId().compareTo(o2.getId());
}
}
}

View file

@ -44,6 +44,12 @@ public class MetaLanguageSiblingLoader implements X4OLanguageModuleLoaderSibling
/** Defines the version of the meta x4o language. */
public static final String META_LANGUAGE_VERSION = "1.0";
/** Defines the identifier of the meta x4o language host. */
public static final String META_LANGUAGE_HOST = "meta.x4o.org";
/** Defines the identifier of the meta x4o language host. */
public static final String META_LANGUAGE_DESCRIPTION = "X4O Meta XML Language Module.";
/**
* Loads an ElementLanguageModule.
* @param language The ElementLanguage to load for.
@ -53,9 +59,9 @@ public class MetaLanguageSiblingLoader implements X4OLanguageModuleLoaderSibling
*/
public void loadLanguageModule(X4OLanguageLocal language,X4OLanguageModule languageModule) throws X4OLanguageModuleLoaderException {
languageModule.setId(META_LANGUAGE);
languageModule.setName(META_LANGUAGE);
languageModule.setProviderHost(META_LANGUAGE_HOST);
languageModule.setProviderName(MetaLanguageSiblingLoader.class.getSimpleName());
languageModule.setDescription("X4O Meta Language");
languageModule.setDescription(META_LANGUAGE_DESCRIPTION);
}
/**

View file

@ -40,6 +40,7 @@
schemaPrefix="mroot"
name="MTest Root Namespace"
languageRoot="true"
id="mroot"
>
<!-- Root Element for nice namespace'ing -->
<eld:element tag="root" objectClass="java.lang.Object">
@ -53,6 +54,7 @@
schemaResource="mtest-lang-1.0.xsd"
schemaPrefix="mlang"
name="MTest Language Namespace"
id="mlang"
>
<eld:element tag="date" objectClass="java.util.Date"/>
<eld:element tag="JFrame" objectClass="javax.swing.JFrame"/>