Added elementParent tag also to elementInterface and fixed eld

elementParent namespace uri bug and updated elddoc and xsd for extra
search.
This commit is contained in:
Willem Cazander 2013-01-08 15:16:57 +01:00
parent 4a700f98a6
commit bcce73b2ad
16 changed files with 159 additions and 94 deletions

View file

@ -294,6 +294,7 @@ public class EldModuleLoaderCore implements ElementLanguageModuleLoader {
ec = new DefaultElementClass("elementParent",null,ElementClassAddParentElement.class); ec = new DefaultElementClass("elementParent",null,ElementClassAddParentElement.class);
ec.addElementParent(CEL_CORE_URI, "element"); ec.addElementParent(CEL_CORE_URI, "element");
ec.addElementParent(CEL_CORE_URI, "elementInterface");
try { try {
attr = (ElementClassAttribute)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguageConfiguration().getDefaultElementClassAttribute()); attr = (ElementClassAttribute)X4OLanguageClassLoader.newInstance(elementLanguage.getLanguageConfiguration().getDefaultElementClassAttribute());
attr.setName("tag"); attr.setName("tag");

View file

@ -24,7 +24,7 @@
package org.x4o.xml.eld.lang; package org.x4o.xml.eld.lang;
import org.x4o.xml.element.AbstractElement; import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementClass; import org.x4o.xml.element.ElementClassBase;
import org.x4o.xml.element.ElementException; import org.x4o.xml.element.ElementException;
/** /**
@ -48,10 +48,10 @@ public class ElementClassAddParentElement extends AbstractElement {
if (namespaceUri==null) { if (namespaceUri==null) {
namespaceUri = getParent().getParent().getAttributes().get("uri"); // copy uri from namespace element. namespaceUri = getParent().getParent().getAttributes().get("uri"); // copy uri from namespace element.
} }
if (getParent().getElementObject() instanceof ElementClass) { if (getParent().getElementObject() instanceof ElementClassBase) {
((ElementClass)getParent().getElementObject()).addElementParent(namespaceUri,tag); ((ElementClassBase)getParent().getElementObject()).addElementParent(namespaceUri,tag);
} else { } else {
throw new ElementException("Wrong parent class is not ElementClass but: "+getParent().getElementObject()); throw new ElementException("Wrong parent class is not ElementClassBase but: "+getParent().getElementObject());
} }
} }
} }

View file

@ -37,6 +37,7 @@ import org.x4o.xml.element.ElementAttributeHandler;
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.ElementInterface;
import org.x4o.xml.element.ElementLanguage; import org.x4o.xml.element.ElementLanguage;
import org.x4o.xml.element.ElementLanguageModule; import org.x4o.xml.element.ElementLanguageModule;
import org.x4o.xml.element.ElementNamespaceContext; import org.x4o.xml.element.ElementNamespaceContext;
@ -129,6 +130,12 @@ public class EldXsdXmlWriter {
} }
} }
} }
for (ElementInterface ei:context.findElementInterfaces(objectClass)) {
List<String> eiTags = ei.getElementParents(namespaceUri);
if (eiTags!=null) {
startNamespace(nsContext.getUri(),nsContext.getSchemaPrefix());
}
}
} }
} }
} }
@ -261,9 +268,10 @@ public class EldXsdXmlWriter {
if (ec.getSchemaContentBase()==null) { if (ec.getSchemaContentBase()==null) {
atts = new AttributesImpl(); atts = new AttributesImpl();
atts.addAttribute ("", "minOccurs", "", "", "0"); // make unordered elements atts.addAttribute ("", "minOccurs", "", "", "0"); // TODO: make unordered elements
atts.addAttribute ("", "maxOccurs", "", "", "unbounded"); atts.addAttribute ("", "maxOccurs", "", "", "unbounded");
xmlWriter.startElement (SCHEMA_URI, "choice", "", atts); xmlWriter.startElement (SCHEMA_URI, "choice", "", atts);
for (ElementLanguageModule mod:context.getElementLanguageModules()) { for (ElementLanguageModule mod:context.getElementLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
writeElementClassNamespaces(ec,nsWrite,ns); writeElementClassNamespaces(ec,nsWrite,ns);
@ -361,27 +369,36 @@ public class EldXsdXmlWriter {
} }
} }
private void writeElementClassNamespaces(ElementClass ec,ElementNamespaceContext nsWrite,ElementNamespaceContext ns) throws SAXException { private void writeElementClassNamespaces(ElementClass ecWrite,ElementNamespaceContext nsWrite,ElementNamespaceContext 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()) {
List<String> parents = checkClass.getElementParents(nsWrite.getUri()); List<String> parents = checkClass.getElementParents(nsWrite.getUri());
if (parents!=null && parents.contains(ec.getTag())) { if (parents!=null && parents.contains(ecWrite.getTag())) {
refElements.add(checkClass.getTag()); refElements.add(checkClass.getTag());
}
if (ec.getObjectClass()==null) {
continue; continue;
} }
if (checkClass.getObjectClass()==null) { if (checkClass.getObjectClass()==null) {
continue; continue;
} }
Class<?> objectClass = ec.getObjectClass(); for (ElementInterface ei:context.findElementInterfaces(checkClass.getObjectClass())) {
parents = ei.getElementParents(nsWrite.getUri());
if (parents!=null && parents.contains(ecWrite.getTag())) {
refElements.add(checkClass.getTag());
break;
}
}
if (ecWrite.getObjectClass()==null) {
continue;
}
Class<?> objectClass = ecWrite.getObjectClass();
Class<?> checkObjectClass = checkClass.getObjectClass(); Class<?> checkObjectClass = checkClass.getObjectClass();
List<ElementBindingHandler> b = context.findElementBindingHandlers(objectClass,checkObjectClass); List<ElementBindingHandler> b = context.findElementBindingHandlers(objectClass,checkObjectClass);
if (b.isEmpty()==false) { if (b.isEmpty()==false) {
refElements.add(checkClass.getTag()); refElements.add(checkClass.getTag());
} }
} }
if (refElements.isEmpty()==false) { if (refElements.isEmpty()==false) {
Set<String> s = new HashSet<String>(refElements.size()); Set<String> s = new HashSet<String>(refElements.size());
s.addAll(refElements); s.addAll(refElements);

View file

@ -40,14 +40,12 @@ public abstract class AbstractElementClass extends AbstractElementClassBase impl
private Class<?> objectClass = null; private Class<?> objectClass = null;
private Class<?> elementClass = null; private Class<?> elementClass = null;
private Boolean autoAttributes = true; private Boolean autoAttributes = true;
private Map<String,List<String>> elementParents = null;
private String schemaContentBase = null; private String schemaContentBase = null;
private Boolean schemaContentComplex = null; private Boolean schemaContentComplex = null;
private Boolean schemaContentMixed = null; private Boolean schemaContentMixed = null;
private List<String> skipPhases = null; private List<String> skipPhases = null;
public AbstractElementClass() { public AbstractElementClass() {
elementParents = new HashMap<String,List<String>>(5);
skipPhases = new ArrayList<String>(3); skipPhases = new ArrayList<String>(3);
} }
@ -107,42 +105,6 @@ public abstract class AbstractElementClass extends AbstractElementClassBase impl
this.autoAttributes = autoAttributes; this.autoAttributes = autoAttributes;
} }
/**
* @see org.x4o.xml.element.ElementClass#addElementParent(java.lang.String,java.lang.String)
*/
public void addElementParent(String namespaceUri,String tag) {
if (namespaceUri==null) {
throw new NullPointerException("Can't add parent tag with null namespace uri.");
}
if (namespaceUri.isEmpty()) {
throw new IllegalArgumentException("Can't add parent tag with empty namespace uri.");
}
List<String> tags = elementParents.get(namespaceUri);
if (tags==null) {
tags = new ArrayList<String>(5);
elementParents.put(namespaceUri, tags);
}
tags.add(tag);
}
/**
* @see org.x4o.xml.element.ElementClass#removeElementParent(java.lang.String,java.lang.String)
*/
public void removeElementParent(String namespaceUri,String tag) {
List<String> tags = elementParents.get(namespaceUri);
if (tags==null) {
return;
}
tags.remove(tag);
}
/**
* @see org.x4o.xml.element.ElementClass#getElementParents(java.lang.String)
*/
public List<String> getElementParents(String namespaceUri) {
return elementParents.get(namespaceUri);
}
/** /**
* @return the schemaContentBase * @return the schemaContentBase
*/ */

View file

@ -39,13 +39,14 @@ public abstract class AbstractElementClassBase extends AbstractElementMetaBase i
private Map<String,ElementClassAttribute> elementClassAttributes = null; private Map<String,ElementClassAttribute> elementClassAttributes = null;
private List<ElementConfigurator> elementConfigurators = null; private List<ElementConfigurator> elementConfigurators = null;
private Map<String,List<String>> elementParents = null;
public AbstractElementClassBase() { public AbstractElementClassBase() {
elementConfigurators = new ArrayList<ElementConfigurator>(5); elementConfigurators = new ArrayList<ElementConfigurator>(5);
elementClassAttributes = new HashMap<String,ElementClassAttribute>(15); elementClassAttributes = new HashMap<String,ElementClassAttribute>(15);
elementParents = new HashMap<String,List<String>>(5);
} }
/** /**
* @see ElementClass#getElementConfigurators() * @see ElementClass#getElementConfigurators()
*/ */
@ -77,4 +78,40 @@ public abstract class AbstractElementClassBase extends AbstractElementMetaBase i
public ElementClassAttribute getElementClassAttributeByName(String attributeName) { public ElementClassAttribute getElementClassAttributeByName(String attributeName) {
return elementClassAttributes.get(attributeName); return elementClassAttributes.get(attributeName);
} }
/**
* @see org.x4o.xml.element.ElementClassBase#addElementParent(java.lang.String,java.lang.String)
*/
public void addElementParent(String namespaceUri,String tag) {
if (namespaceUri==null) {
throw new NullPointerException("Can't add parent tag with null namespace uri.");
}
if (namespaceUri.isEmpty()) {
throw new IllegalArgumentException("Can't add parent tag with empty namespace uri.");
}
List<String> tags = elementParents.get(namespaceUri);
if (tags==null) {
tags = new ArrayList<String>(5);
elementParents.put(namespaceUri, tags);
}
tags.add(tag);
}
/**
* @see org.x4o.xml.element.ElementClassBase#removeElementParent(java.lang.String,java.lang.String)
*/
public void removeElementParent(String namespaceUri,String tag) {
List<String> tags = elementParents.get(namespaceUri);
if (tags==null) {
return;
}
tags.remove(tag);
}
/**
* @see org.x4o.xml.element.ElementClassBase#getElementParents(java.lang.String)
*/
public List<String> getElementParents(String namespaceUri) {
return elementParents.get(namespaceUri);
}
} }

View file

@ -130,11 +130,12 @@ public abstract class AbstractElementLanguageModule extends AbstractElementMetaB
throw new NullPointerException("Can't add with null id property."); throw new NullPointerException("Can't add with null id property.");
} }
// Check so doc tree does not loop; see EldDocHtmlWriter.findChilderen() // Check so doc tree does not loop; see EldDocHtmlWriter.findChilderen()
/*
for (Class<?> cl:elementBindingHandler.getBindChildClasses()) { for (Class<?> cl:elementBindingHandler.getBindChildClasses()) {
if (elementBindingHandler.getBindParentClass().equals(cl)) { if (elementBindingHandler.getBindParentClass().equals(cl)) {
throw new IllegalStateException("Can't add binding handler: "+elementBindingHandler.getId()+" with same parent as child class."); throw new IllegalStateException("Can't add binding handler: "+elementBindingHandler.getId()+" with same parent as child class.");
} }
} }*/
logger.finer("Adding ElementBindingHandler: "+elementBindingHandler); logger.finer("Adding ElementBindingHandler: "+elementBindingHandler);
elementBindingHandlers.add(elementBindingHandler); elementBindingHandlers.add(elementBindingHandler);
} }

View file

@ -78,29 +78,6 @@ public interface ElementClass extends ElementClassBase {
*/ */
void setAutoAttributes(Boolean autoAttributes); void setAutoAttributes(Boolean autoAttributes);
/**
* Add an parent element tag.
* Used: for xsd only.
* @param namespaceUri The namespace uri of this tag relation.
* @param tag The parent element tag.
*/
void addElementParent(String namespaceUri,String tag);
/**
* Remove and parent element
* Used: for xsd only.
* @param namespaceUri The namespace uri of this tag relation.
* @param tag The parent element tag.
*/
void removeElementParent(String namespaceUri,String tag);
/**
* Returns list of parent element tags.
* @param namespaceUri The namespace uri of this tag relation.
* @return The list of tags.
*/
List<String> getElementParents(String namespaceUri);
/** /**
* @return the schemaContentBase * @return the schemaContentBase
*/ */

View file

@ -41,4 +41,28 @@ public interface ElementClassBase extends ElementMetaBase {
Collection<ElementClassAttribute> getElementClassAttributes(); Collection<ElementClassAttribute> getElementClassAttributes();
ElementClassAttribute getElementClassAttributeByName(String attributeName); ElementClassAttribute getElementClassAttributeByName(String attributeName);
void addElementClassAttribute(ElementClassAttribute elementClassAttribute); void addElementClassAttribute(ElementClassAttribute elementClassAttribute);
/**
* Add an parent element tag.
* Used: for xsd/doc only.
* @param namespaceUri The namespace uri of this tag relation.
* @param tag The parent element tag.
*/
void addElementParent(String namespaceUri,String tag);
/**
* Remove and parent element
* Used: for xsd/doc only.
* @param namespaceUri The namespace uri of this tag relation.
* @param tag The parent element tag.
*/
void removeElementParent(String namespaceUri,String tag);
/**
* Returns list of parent element tags.
* Used: for xsd/doc only.
* @param namespaceUri The namespace uri of this tag relation.
* @return The list of tags.
*/
List<String> getElementParents(String namespaceUri);
} }

View file

@ -7,7 +7,7 @@
ModuleName: Core Element Languag Module ModuleName: Core Element Languag Module
Namespaces: 2 Namespaces: 2
Namespace: http://cel.x4o.org/xml/ns/cel-core Namespace: http://cel.x4o.org/xml/ns/cel-core
Created on: Thu Dec 20 22:30:55 CET 2012 Created on: Tue Jan 08 06:02:28 CET 2013
--> -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://cel.x4o.org/xml/ns/cel-core" xmlns:this="http://cel.x4o.org/xml/ns/cel-core"
@ -44,11 +44,11 @@
</choice> </choice>
<attribute name="objectClass" type="string"/> <attribute name="objectClass" type="string"/>
<attribute name="elementClass" type="string"/> <attribute name="elementClass" type="string"/>
<attribute name="tag" type="string"/> <attribute name="schemaContentBase" type="string"/>
<attribute name="autoAttributes" type="boolean"/> <attribute name="autoAttributes" type="boolean"/>
<attribute name="schemaContentComplex" type="boolean"/> <attribute name="schemaContentComplex" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/> <attribute name="schemaContentMixed" type="boolean"/>
<attribute name="schemaContentBase" type="string"/> <attribute name="tag" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
<attribute name="id" type="string"/> <attribute name="id" type="string"/>
</complexType> </complexType>
@ -81,12 +81,12 @@
<element name="description" type="this:descriptionType"/> <element name="description" type="this:descriptionType"/>
</choice> </choice>
<attribute name="name" type="string"/> <attribute name="name" type="string"/>
<attribute name="required" type="boolean"/> <attribute name="objectConverter" type="string"/>
<attribute name="runResolveEL" type="boolean"/> <attribute name="runResolveEL" type="boolean"/>
<attribute name="runConverters" type="boolean"/> <attribute name="runConverters" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="objectConverter" type="string"/>
<attribute name="runBeanFill" type="boolean"/> <attribute name="runBeanFill" type="boolean"/>
<attribute name="required" type="boolean"/>
<attribute name="defaultValue" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
<attribute name="id" type="string"/> <attribute name="id" type="string"/>
</complexType> </complexType>
@ -107,6 +107,7 @@
<element name="bindingHandler" type="this:bindingHandlerType"/> <element name="bindingHandler" type="this:bindingHandlerType"/>
<element name="configurator" type="this:configuratorType"/> <element name="configurator" type="this:configuratorType"/>
<element name="description" type="this:descriptionType"/> <element name="description" type="this:descriptionType"/>
<element name="elementParent" type="this:elementParentType"/>
</choice> </choice>
<attribute name="interfaceClass" type="string"/> <attribute name="interfaceClass" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>

View file

@ -7,7 +7,7 @@
ModuleName: Core Element Languag Module ModuleName: Core Element Languag Module
Namespaces: 2 Namespaces: 2
Namespace: http://cel.x4o.org/xml/ns/cel-root Namespace: http://cel.x4o.org/xml/ns/cel-root
Created on: Thu Dec 20 22:30:55 CET 2012 Created on: Tue Jan 08 06:02:28 CET 2013
--> -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cel-core="http://cel.x4o.org/xml/ns/cel-core" xmlns:cel-core="http://cel.x4o.org/xml/ns/cel-core"
@ -25,8 +25,8 @@
</choice> </choice>
<attribute name="name" type="string"/> <attribute name="name" type="string"/>
<attribute name="providerName" type="string"/> <attribute name="providerName" type="string"/>
<attribute name="elementLanguageModuleLoader" type="string"/>
<attribute name="sourceResource" type="string"/> <attribute name="sourceResource" type="string"/>
<attribute name="elementLanguageModuleLoader" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
<attribute name="id" type="string"/> <attribute name="id" type="string"/>
</complexType> </complexType>

View file

@ -7,7 +7,7 @@
ModuleName: Element Language Definition ModuleName: Element Language Definition
Namespaces: 3 Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-conv Namespace: http://eld.x4o.org/xml/ns/eld-conv
Created on: Thu Dec 20 22:30:10 CET 2012 Created on: Tue Jan 08 06:03:20 CET 2013
--> -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:this="http://eld.x4o.org/xml/ns/eld-conv" xmlns:this="http://eld.x4o.org/xml/ns/eld-conv"

View file

@ -7,7 +7,7 @@
ModuleName: Element Language Definition ModuleName: Element Language Definition
Namespaces: 3 Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-lang Namespace: http://eld.x4o.org/xml/ns/eld-lang
Created on: Thu Dec 20 22:30:10 CET 2012 Created on: Tue Jan 08 06:03:20 CET 2013
--> -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv" xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
@ -55,10 +55,10 @@
<attribute name="objectClass" type="string"/> <attribute name="objectClass" type="string"/>
<attribute name="elementClass" type="string"/> <attribute name="elementClass" type="string"/>
<attribute name="tag" type="string"/> <attribute name="tag" type="string"/>
<attribute name="schemaContentBase" type="string"/>
<attribute name="autoAttributes" type="boolean"/> <attribute name="autoAttributes" type="boolean"/>
<attribute name="schemaContentComplex" type="boolean"/> <attribute name="schemaContentComplex" type="boolean"/>
<attribute name="schemaContentMixed" type="boolean"/> <attribute name="schemaContentMixed" type="boolean"/>
<attribute name="schemaContentBase" type="string"/>
<attribute name="id" type="string"/> <attribute name="id" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
</complexType> </complexType>
@ -128,11 +128,11 @@
</choice> </choice>
<attribute name="name" type="string"/> <attribute name="name" type="string"/>
<attribute name="defaultValue" type="string"/> <attribute name="defaultValue" type="string"/>
<attribute name="required" type="boolean"/>
<attribute name="objectConverter" type="string"/> <attribute name="objectConverter" type="string"/>
<attribute name="runResolveEL" type="boolean"/> <attribute name="runResolveEL" type="boolean"/>
<attribute name="runConverters" type="boolean"/> <attribute name="runConverters" type="boolean"/>
<attribute name="runBeanFill" type="boolean"/> <attribute name="runBeanFill" type="boolean"/>
<attribute name="required" type="boolean"/>
<attribute name="id" type="string"/> <attribute name="id" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
</complexType> </complexType>
@ -169,6 +169,7 @@
<element name="classBindingHandler" type="this:classBindingHandlerType"/> <element name="classBindingHandler" type="this:classBindingHandlerType"/>
<element name="configurator" type="this:configuratorType"/> <element name="configurator" type="this:configuratorType"/>
<element name="description" type="this:descriptionType"/> <element name="description" type="this:descriptionType"/>
<element name="elementParent" type="this:elementParentType"/>
</choice> </choice>
<attribute name="id" type="string" use="required"/> <attribute name="id" type="string" use="required"/>
<attribute name="interfaceClass" type="string" use="required"/> <attribute name="interfaceClass" type="string" use="required"/>
@ -177,7 +178,7 @@
<complexType name="elementParentType"> <complexType name="elementParentType">
<choice minOccurs="0" maxOccurs="unbounded"/> <choice minOccurs="0" maxOccurs="unbounded"/>
<attribute name="tag" type="string"/> <attribute name="tag" type="string"/>
<attribute name="namespaceUri" type="string"/> <attribute name="uri" type="string"/>
<anyAttribute/> <anyAttribute/>
</complexType> </complexType>
<element name="namespace" type="this:namespaceType"> <element name="namespace" type="this:namespaceType">

View file

@ -180,11 +180,12 @@
<element tag="elementParent" elementClass="org.x4o.xml.eld.lang.ElementClassAddParentElement"> <element tag="elementParent" elementClass="org.x4o.xml.eld.lang.ElementClassAddParentElement">
<description>Adds an parent element tag for xsd</description> <description>Adds an parent element tag for xsd</description>
<elementParent tag="element"/> <elementParent tag="element"/>
<elementParent tag="elementInterface"/>
<attribute name="tag"> <attribute name="tag">
<description>The parent tag to have object for.</description> <description>The parent tag to have object for.</description>
</attribute> </attribute>
<attribute name="namespaceUri"> <attribute name="uri">
<description>The element namespace uri if non local.</description> <description>The element namespace uri if non local parent.</description>
</attribute> </attribute>
</element> </element>

View file

@ -7,7 +7,7 @@
ModuleName: Element Language Definition ModuleName: Element Language Definition
Namespaces: 3 Namespaces: 3
Namespace: http://eld.x4o.org/xml/ns/eld-root Namespace: http://eld.x4o.org/xml/ns/eld-root
Created on: Thu Dec 20 22:30:10 CET 2012 Created on: Tue Jan 08 06:03:20 CET 2013
--> -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" <schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv" xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
@ -30,8 +30,8 @@
<attribute name="id" type="string" use="required"/> <attribute name="id" type="string" use="required"/>
<attribute name="name" type="string"/> <attribute name="name" type="string"/>
<attribute name="providerName" type="string"/> <attribute name="providerName" type="string"/>
<attribute name="elementLanguageModuleLoader" type="string"/>
<attribute name="sourceResource" type="string"/> <attribute name="sourceResource" type="string"/>
<attribute name="elementLanguageModuleLoader" type="string"/>
<attribute name="description" type="string"/> <attribute name="description" type="string"/>
</complexType> </complexType>
</element> </element>

View file

@ -46,6 +46,12 @@
<eld:classBindingHandler id="Root-Bean" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestBean" method="addTestBean"> <eld:classBindingHandler id="Root-Bean" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestBean" method="addTestBean">
<eld:description>Binds the TestBean to the TestObjectRoot</eld:description> <eld:description>Binds the TestBean to the TestObjectRoot</eld:description>
</eld:classBindingHandler> </eld:classBindingHandler>
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" method="addComponent">
<eld:description>Binds j components.</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="JFrame-JPanel" parentClass="javax.swing.JFrame" childClass="javax.swing.JPanel" method="add">
<eld:description>Binds panel to frame components as unit check.</eld:description>
</eld:classBindingHandler>
<eld:elementInterface id="Component" interfaceClass="java.awt.Component"> <eld:elementInterface id="Component" interfaceClass="java.awt.Component">
<eld:description>Configs the Component based objects.</eld:description> <eld:description>Configs the Component based objects.</eld:description>
@ -132,7 +138,9 @@
--> -->
</eld:element> </eld:element>
<eld:element tag="JFrame" objectClass="javax.swing.JFrame"/> <eld:element tag="JFrame" objectClass="javax.swing.JFrame">
<eld:elementParent tag="root" uri="http://test.x4o.org/xml/ns/test-root"/>
</eld:element>
<eld:element tag="JFrameContentPane" elementClass="org.x4o.xml.test.element.ContentPaneElement"/> <eld:element tag="JFrameContentPane" elementClass="org.x4o.xml.test.element.ContentPaneElement"/>
<eld:element tag="JLabel" objectClass="javax.swing.JLabel"/> <eld:element tag="JLabel" objectClass="javax.swing.JLabel"/>
<eld:element tag="JPanel" objectClass="javax.swing.JPanel"/> <eld:element tag="JPanel" objectClass="javax.swing.JPanel"/>

View file

@ -298,7 +298,6 @@ public class EldDocHtmlWriter {
if (node.indent>20) { if (node.indent>20) {
return result; // hard fail limit return result; // hard fail limit
} }
for (ElementLanguageModule mod:node.context.getElementLanguageModules()) { for (ElementLanguageModule mod:node.context.getElementLanguageModules()) {
for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) { for (ElementNamespaceContext ns:mod.getElementNamespaceContexts()) {
for (ElementClass ec:ns.getElementClasses()) { for (ElementClass ec:ns.getElementClasses()) {
@ -313,7 +312,25 @@ public class EldDocHtmlWriter {
n.indent=node.indent+1; n.indent=node.indent+1;
n.parent=node; n.parent=node;
} else { } else {
if (node.elementClass.getObjectClass()==null | ec.getObjectClass()==null) { if (ec.getObjectClass()==null) {
continue;
}
// Check interfaces of child , and see if parent tag is there.
for (ElementInterface ei:node.context.findElementInterfaces(ec.getObjectClass())) {
List<String> eiTags = ei.getElementParents(node.namespace.getUri());
if (eiTags!=null && eiTags.contains(node.elementClass.getTag())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
n.namespace=ns;
n.elementClass=ec;
n.indent=node.indent+1;
n.parent=node;
break;
}
}
if (node.elementClass.getObjectClass()==null) {
continue; continue;
} }
List<ElementBindingHandler> binds = node.context.findElementBindingHandlers(node.elementClass.getObjectClass(), ec.getObjectClass()); List<ElementBindingHandler> binds = node.context.findElementBindingHandlers(node.elementClass.getObjectClass(), ec.getObjectClass());
@ -372,7 +389,25 @@ public class EldDocHtmlWriter {
} }
} }
for (ElementClass ec:ns.getElementClasses()) { for (ElementClass ec:ns.getElementClasses()) {
if (node.elementClass.getObjectClass()==null | ec.getObjectClass()==null) { if (ec.getObjectClass()==null) {
continue;
}
// Check interfaces of child , and see if parent tag is there.
for (ElementInterface ei:node.context.findElementInterfaces(ec.getObjectClass())) {
List<String> eiTags = ei.getElementParents(node.namespace.getUri());
if (eiTags!=null && eiTags.contains(node.elementClass.getTag())) {
n = new TreeNode();
n.context=node.context;
n.module=mod;
n.namespace=ns;
n.elementClass=ec;
n.indent=node.indent+1;
n.parent=node;
result.add(n);
break;
}
}
if (node.elementClass.getObjectClass()==null) {
continue; continue;
} }
List<ElementBindingHandler> binds = node.context.findElementBindingHandlers(ec.getObjectClass(),node.elementClass.getObjectClass()); List<ElementBindingHandler> binds = node.context.findElementBindingHandlers(ec.getObjectClass(),node.elementClass.getObjectClass());