[jboss-svn-commits] JBoss Common SVN: r2367 - in jbossxb/branches/1_0/src: main/java/org/jboss/xb/binding/sunday/unmarshalling and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 5 11:46:02 EDT 2007
Author: alex.loubyansky at jboss.com
Date: 2007-04-05 11:46:02 -0400 (Thu, 05 Apr 2007)
New Revision: 2367
Added:
jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomCharactersHandler.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomLocalMarshaller.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomParticleHandler.java
jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.java
jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.xsd
jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_complexContent.xml
jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_simpleContent.xml
Modified:
jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallerImpl.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBinding.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/WildcardBinding.java
jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinder.java
jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AbstractJBossXBTest.java
jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java
jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsUnitTestCase.java
Log:
JBXB-97
Modified: jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallerImpl.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallerImpl.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallerImpl.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -575,7 +575,7 @@
String characters = null;
TypeBinding simpleType = type.getSimpleType();
- if(simpleType != null)
+ if(simpleType != null && !Constants.QNAME_ANYTYPE.equals(type.getQName()))
{
String fieldName = ctx.getSimpleContentProperty();
CharactersMetaData charactersMetaData = type.getCharactersMetaData();
@@ -812,24 +812,25 @@
}
else
{
+ ObjectLocalMarshaller marshaller = wildcard.getUnresolvedMarshaller();
+ if(marshaller != null)
+ {
+ marshaller.marshal(ctx, o);
+ return true;
+ }
+
+ String msg = "Failed to marshal wildcard: neither class mapping was found for "
+ + o.getClass() + "@" + o.hashCode()
+ + " (toString: " + o
+ + ") nor marshaller for unresolved classes was setup.";
if(ignoreUnresolvedWildcard)
{
- log.warn("Failed to marshal wildcard. Class mapping not found for " +
- o.getClass() +
- "@" +
- o.hashCode() +
- ": " + o
- );
+ log.warn(msg);
return true;
}
else
{
- throw new IllegalStateException("Failed to marshal wildcard. Class mapping not found for " +
- o.getClass() +
- "@" +
- o.hashCode() +
- ": " + o
- );
+ throw new JBossXBRuntimeException(msg);
}
}
}
Modified: jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBinding.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBinding.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBinding.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -34,7 +34,11 @@
import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller;
import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
import org.jboss.xb.binding.metadata.PackageMetaData;
+import org.jboss.xb.util.DomCharactersHandler;
+import org.jboss.xb.util.DomLocalMarshaller;
+import org.jboss.xb.util.DomParticleHandler;
+
/**
* A SchemaBinding is a collection of binding objects (TypeBinding,
* ChoiceBinding, ElementBinding, ModelGroupBinding, SequenceBinding, WildcardBinding)
@@ -384,6 +388,47 @@
this.xopMarshaller = xopMarshaller;
}
+ public void setUnresolvedContentBoundToDOM(boolean toDom)
+ {
+ TypeBinding type = getType(Constants.QNAME_ANYTYPE);
+ if(type == null)
+ {
+ // ignore, there is no use of the anyType in the schema
+ return;
+ //throw new JBossXBRuntimeException("anyType is not bound.");
+ }
+
+ WildcardBinding wildcard = type.getWildcard();
+ if(toDom)
+ {
+ wildcard.setUnresolvedCharactersHandler(DomCharactersHandler.INSTANCE);
+ wildcard.setUnresolvedElementHandler(DomParticleHandler.INSTANCE);
+ wildcard.setUnresolvedMarshaller(DomLocalMarshaller.INSTANCE);
+ }
+ else
+ {
+ wildcard.setUnresolvedCharactersHandler(null);
+ wildcard.setUnresolvedElementHandler(null);
+ wildcard.setUnresolvedMarshaller(null);
+ }
+ }
+
+ public boolean isUnresolvedContentBoundToDOM()
+ {
+ TypeBinding type = getType(Constants.QNAME_ANYTYPE);
+ if(type == null)
+ {
+ // there is no use of the anyType in the schema
+ return false;
+ //throw new JBossXBRuntimeException("anyType is not bound.");
+ }
+
+ WildcardBinding wildcard = type.getWildcard();
+ return wildcard.getUnresolvedCharactersHandler() instanceof DomCharactersHandler
+ && wildcard.getUnresolvedElementHandler() instanceof DomParticleHandler
+ && wildcard.getUnresolvedMarshaller() instanceof DomLocalMarshaller;
+ }
+
void addElementParticle(ParticleBinding particle)
{
ElementBinding element = (ElementBinding)particle.getTerm();
Modified: jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -263,17 +263,22 @@
public AttributeBinding addAttribute(QName name, TypeBinding type, AttributeHandler handler)
{
AttributeBinding attr = new AttributeBinding(schemaBinding, name, type, handler);
+ addAttribute(attr);
+ return attr;
+ }
+
+ public void addAttribute(AttributeBinding attr)
+ {
switch(attrs.size())
{
case 0:
- attrs = Collections.singletonMap(name, attr);
+ attrs = Collections.singletonMap(attr.getQName(), attr);
break;
case 1:
attrs = new HashMap(attrs);
default:
- attrs.put(name, attr);
+ attrs.put(attr.getQName(), attr);
}
- return attr;
}
public Collection getAttributes()
@@ -447,21 +452,23 @@
this.startElementCreatesObject = startElementCreatesObject ? Boolean.TRUE : Boolean.FALSE;
}
- public void setWildcard(WildcardBinding wildcard)
- {
- this.wildcard = wildcard;
- }
-
+ private boolean initializedWildcard;
public WildcardBinding getWildcard()
{
+ if(initializedWildcard)
+ {
+ return wildcard;
+ }
+
+ if(particle != null)
+ {
+ wildcard = getWildcard(particle.getTerm());
+ initializedWildcard = true;
+ }
+
return wildcard;
}
- public boolean hasWildcard()
- {
- return wildcard != null;
- }
-
public ParticleBinding getParticle()
{
return particle;
@@ -591,4 +598,33 @@
{
return super.toString() + "[" + qName + "]";
}
+
+ private static WildcardBinding getWildcard(TermBinding term)
+ {
+ if(term.isWildcard())
+ {
+ return (WildcardBinding) term;
+ }
+
+ if(term.isModelGroup())
+ {
+ ModelGroupBinding group = (ModelGroupBinding) term;
+ for(Iterator i = group.getParticles().iterator(); i.hasNext();)
+ {
+ term = ((ParticleBinding)i.next()).getTerm();
+ if(term.isWildcard())
+ {
+ return (WildcardBinding)term;
+ }
+ else if(term.isModelGroup())
+ {
+ WildcardBinding wc = getWildcard(term);
+ if (wc != null)
+ return wc;
+ }
+ }
+ }
+
+ return null;
+ }
}
Modified: jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/WildcardBinding.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/WildcardBinding.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/WildcardBinding.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.ObjectLocalMarshaller;
import org.jboss.xb.binding.Util;
import org.xml.sax.Attributes;
@@ -43,9 +44,9 @@
private QName qName;
private SchemaBindingResolver schemaResolver;
private short pc;
-
private ParticleHandler unresolvedElementHandler;
private CharactersHandler unresolvedCharactersHandler;
+ private ObjectLocalMarshaller unresolvedMarshaller;
private ParticleHandler wildcardHandler;
public WildcardBinding(SchemaBinding schema)
@@ -132,6 +133,16 @@
this.unresolvedCharactersHandler = unresolvedCharactersHandler;
}
+ public ObjectLocalMarshaller getUnresolvedMarshaller()
+ {
+ return unresolvedMarshaller;
+ }
+
+ public void setUnresolvedMarshaller(ObjectLocalMarshaller marshaller)
+ {
+ this.unresolvedMarshaller = marshaller;
+ }
+
public ElementBinding getElement(QName qName, Attributes attrs)
{
if(pc == PC_SKIP)
Modified: jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinder.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinder.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinder.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -76,8 +76,15 @@
{
static final Logger log = Logger.getLogger(XsdBinder.class);
- private XsdBinder()
+ /**
+ * Creates a new instance of the binder the user can use to tune
+ * configuration before parsing the XSD.
+ *
+ * @return a new instance of the XsdBinder
+ */
+ public static XsdBinder newInstance()
{
+ return new XsdBinder();
}
/**
@@ -237,6 +244,160 @@
public static SchemaBinding bind(XSModel model, SchemaBindingResolver resolver, boolean processAnnotations)
{
+ XsdBinder binder = new XsdBinder();
+ binder.setProcessAnnotations(processAnnotations);
+ binder.setSchemaResolver(resolver);
+ return binder.parse(model);
+ }
+
+ /**
+ * @param schema schema binding the type should be added to
+ * @param type type definition to be bound
+ * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS.
+ * It will be removed when anonymous type binding in JBossWS is implemented properly.
+ * No one else should use this method.</i>
+ *
+ * <p>This method binds a type definition and adds it as a global type to the passed in schema binding.
+ */
+ public static void bindType(SchemaBinding schema, XSTypeDefinition type)
+ {
+ TypeBinding typeBinding = bindType(new Context(schema), type);
+ schema.addType(typeBinding);
+ }
+
+ /**
+ * @param schema schema binding the type should be added to
+ * @param element element declaration to be bound
+ * @param minOccurs
+ * @param maxOccurs
+ * @param maxOccursUnbounded
+ * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS.
+ * It will be removed when anonymous type binding in JBossWS is implemented properly.
+ * No one else should use this method.</i>
+ *
+ * <p>This method binds an element declaration and adds it as a global element to the passed in schema binding.
+ */
+ public static void bindElement(SchemaBinding schema,
+ XSElementDeclaration element,
+ int minOccurs,
+ int maxOccurs,
+ boolean maxOccursUnbounded)
+ {
+ ParticleBinding particle = bindElement(new Context(schema),
+ element,
+ minOccurs,
+ maxOccurs,
+ maxOccursUnbounded
+ );
+ schema.addElementParticle(particle);
+ }
+
+ // Exposed attributes
+
+ private boolean processAnnotations = true;
+ private SchemaBindingResolver resolver;
+ private boolean simpleContentWithIdAsSimpleType = true;
+ private boolean unresolvedContentBoundToDOM = true;
+
+ // Internal attributes
+
+ private boolean trace = log.isTraceEnabled();
+ private final SchemaBinding schema;
+ private SharedElements sharedElements = new SharedElements();
+ private final List typeGroupStack = new ArrayList();
+
+ // Ctors
+
+ private XsdBinder()
+ {
+ this(new SchemaBinding());
+ }
+
+ private XsdBinder(SchemaBinding schema)
+ {
+ this.schema = schema;
+ }
+
+ // Public
+
+ public void setProcessAnnotations(boolean processAnnotations)
+ {
+ this.processAnnotations = processAnnotations;
+ }
+
+ public boolean isProcessAnnotations()
+ {
+ return processAnnotations;
+ }
+
+ public void setSchemaResolver(SchemaBindingResolver resolver)
+ {
+ this.resolver = resolver;
+ }
+
+ public SchemaBindingResolver getSchemaResolver()
+ {
+ return resolver;
+ }
+
+ public void setSimpleContentWithIdAsSimpleType(boolean simpleContentWithIdAsSimpleType)
+ {
+ this.simpleContentWithIdAsSimpleType = simpleContentWithIdAsSimpleType;
+ }
+
+ public boolean isSimpleContentWithIdAsSimpleType()
+ {
+ return simpleContentWithIdAsSimpleType;
+ }
+
+ public void setUnresolvedContentBoundToDOM(boolean toDOM)
+ {
+ this.unresolvedContentBoundToDOM = toDOM;
+ }
+
+ public boolean isUnresolvedContentBoundToDOM()
+ {
+ return this.unresolvedContentBoundToDOM;
+ }
+
+ public SchemaBinding parse(String xsdUrl)
+ {
+ if(resolver == null)
+ {
+ resolver = new DefaultSchemaResolver();
+ }
+
+ XSModel model = Util.loadSchema(xsdUrl, resolver);
+ return parse(model);
+ }
+
+ public SchemaBinding parse(InputStream xsdStream, String encoding)
+ {
+ if(resolver == null)
+ {
+ resolver = new DefaultSchemaResolver();
+ }
+
+ XSModel model = Util.loadSchema(xsdStream, encoding, resolver);
+ return parse(model);
+ }
+
+ public SchemaBinding parse(Reader xsdReader, String encoding)
+ {
+ if(resolver == null)
+ {
+ resolver = new DefaultSchemaResolver();
+ }
+
+ XSModel model = Util.loadSchema(xsdReader, encoding, resolver);
+ return parse(model);
+ }
+
+
+ // Private
+
+ public SchemaBinding parse(XSModel model)
+ {
Context ctx = new Context();
ctx.processAnnotations = processAnnotations;
SchemaBinding schema = ctx.schema;
@@ -315,6 +476,8 @@
bindElement(ctx, element, 1, 0, false);
}
+ schema.setUnresolvedContentBoundToDOM(true);
+
if (ctx.trace)
{
log.trace("finished binding schema " + schema);
@@ -323,50 +486,6 @@
return schema;
}
- /**
- * @param schema schema binding the type should be added to
- * @param type type definition to be bound
- * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS.
- * It will be removed when anonymous type binding in JBossWS is implemented properly.
- * No one else should use this method.</i>
- *
- * <p>This method binds a type definition and adds it as a global type to the passed in schema binding.
- */
- public static void bindType(SchemaBinding schema, XSTypeDefinition type)
- {
- TypeBinding typeBinding = bindType(new Context(schema), type);
- schema.addType(typeBinding);
- }
-
- /**
- * @param schema schema binding the type should be added to
- * @param element element declaration to be bound
- * @param minOccurs
- * @param maxOccurs
- * @param maxOccursUnbounded
- * @deprecated <i>This method is added temporary to get anonymous type binding working in JBossWS.
- * It will be removed when anonymous type binding in JBossWS is implemented properly.
- * No one else should use this method.</i>
- *
- * <p>This method binds an element declaration and adds it as a global element to the passed in schema binding.
- */
- public static void bindElement(SchemaBinding schema,
- XSElementDeclaration element,
- int minOccurs,
- int maxOccurs,
- boolean maxOccursUnbounded)
- {
- ParticleBinding particle = bindElement(new Context(schema),
- element,
- minOccurs,
- maxOccurs,
- maxOccursUnbounded
- );
- schema.addElementParticle(particle);
- }
-
- // Private
-
private static TypeBinding bindType(Context ctx, XSTypeDefinition type)
{
TypeBinding binding;
@@ -920,15 +1039,6 @@
particleBinding.setMinOccurs(particle.getMinOccurs());
group.addParticle(particleBinding);
- TypeBinding type = ctx.peekType();
- type.setWildcard(binding);
-
- if (ctx.trace)
- {
- log.trace("added wildcard to " + group);
- log.trace("added wildcard to type " + type.getQName());
- }
-
XSWildcard wildcard = (XSWildcard)particle.getTerm();
if(wildcard.getName() != null)
{
Added: jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomCharactersHandler.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomCharactersHandler.java (rev 0)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomCharactersHandler.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.util;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.metadata.ValueMetaData;
+import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+
+/**
+ * CharactersHandler that unmarshals into org.w3c.dom.Element.
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 46112 $</tt>
+ */
+public class DomCharactersHandler
+ extends CharactersHandler
+{
+ public static final DomCharactersHandler INSTANCE = new DomCharactersHandler();
+
+ public Object unmarshalEmpty(QName qName,
+ TypeBinding typeBinding,
+ NamespaceContext nsCtx,
+ ValueMetaData valueMetaData)
+ {
+ return "";
+ }
+
+ public Object unmarshal(QName qName,
+ TypeBinding typeBinding,
+ NamespaceContext nsCtx,
+ ValueMetaData valueMetaData,
+ String value)
+ {
+ return value;
+ }
+
+ public void setValue(QName qName, ElementBinding element, Object owner, Object value)
+ {
+ if(!(owner instanceof Element))
+ {
+ throw new JBossXBRuntimeException("The parent must be an instance of "
+ + Element.class + ": parent=" + owner);
+ }
+
+ Element e = (Element)owner;
+ Text textNode = e.getOwnerDocument().createTextNode((String)value);
+ e.appendChild(textNode);
+ }
+}
Added: jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomLocalMarshaller.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomLocalMarshaller.java (rev 0)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomLocalMarshaller.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.util;
+
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.MarshallingContext;
+import org.jboss.xb.binding.ObjectLocalMarshaller;
+import org.w3c.dom.Element;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+/**
+ * ObjectLocalMarshaller that marshals org.w3c.dom.Element.
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 46112 $</tt>
+ */
+public class DomLocalMarshaller
+ implements ObjectLocalMarshaller
+{
+ public static final DomLocalMarshaller INSTANCE = new DomLocalMarshaller();
+
+ public void marshal(MarshallingContext ctx, Object o)
+ {
+ if(!(o instanceof Element))
+ {
+ throw new JBossXBRuntimeException("The argument must be an instance of " + Element.class + ": arg=" + o);
+ }
+
+ Element e = (Element)o;
+
+ ContentHandler ch = ctx.getContentHandler();
+ try
+ {
+ Dom2Sax.dom2sax(e, ch);
+ }
+ catch (SAXException e1)
+ {
+ throw new JBossXBRuntimeException("Failed to SAX the DOM");
+ }
+ }
+}
Added: jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomParticleHandler.java
===================================================================
--- jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomParticleHandler.java (rev 0)
+++ jbossxb/branches/1_0/src/main/java/org/jboss/xb/util/DomParticleHandler.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.xb.util;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.xb.binding.JBossXBRuntimeException;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+
+/**
+ * ParticleHandler that unmarshals into org.w3c.dom.Element.
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 46112 $</tt>
+ */
+public class DomParticleHandler extends RtElementHandler implements ParticleHandler
+{
+ public static final DomParticleHandler INSTANCE = new DomParticleHandler();
+
+ private Document doc;
+
+ public Object startParticle(Object parent,
+ QName elementName,
+ ParticleBinding particle,
+ Attributes attrs,
+ NamespaceContext nsCtx)
+ {
+ Document doc = getDocument();
+ Element element = doc.createElementNS(elementName.getNamespaceURI(), elementName.getLocalPart());
+
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); ++i)
+ {
+ element.setAttribute(attrs.getLocalName(i), attrs.getValue(i));
+ }
+ }
+
+ return element;
+ }
+
+ public Object endParticle(Object o, QName elementName, ParticleBinding particle)
+ {
+ return o;
+ }
+
+ public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle,
+ ParticleBinding parentParticle)
+ {
+ if (parent instanceof Element)
+ {
+ ((Element) parent).appendChild((Element) o);
+ }
+ else
+ {
+ super.setParent(parent, o, elementName, particle, parentParticle);
+ }
+ }
+
+ private Document getDocument()
+ {
+ if (doc == null)
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder domBuilder = null;
+ try
+ {
+ domBuilder = factory.newDocumentBuilder();
+ }
+ catch (ParserConfigurationException e)
+ {
+ throw new JBossXBRuntimeException("Failed to create document builder instance", e);
+ }
+ doc = domBuilder.newDocument();
+ }
+ return doc;
+ }
+}
Modified: jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AbstractJBossXBTest.java
===================================================================
--- jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AbstractJBossXBTest.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AbstractJBossXBTest.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -26,11 +26,8 @@
import org.jboss.test.AbstractTestCaseWithSetup;
import org.jboss.test.AbstractTestDelegate;
import org.jboss.util.Classes;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
/**
* AbstractJBossXBTest.
@@ -54,6 +51,58 @@
super(name);
}
+ /**
+ * Validates XML content passed in the second argument
+ * against the XML content in the file.
+ *
+ * @param xmlFileName the name of the XML file
+ * @param content the content to validate
+ */
+ public void assertXmlFileContent(String xmlFileName, String content)
+ {
+ URL expectedUrl = getResource(xmlFileName);
+ if(expectedUrl == null)
+ {
+ fail("File not found: " + xmlFileName);
+ }
+
+ java.io.InputStream is = null;
+ String expectedContent = null;
+ try
+ {
+ is = expectedUrl.openStream();
+ byte[] bytes = new byte[is.available()];
+ is.read(bytes);
+ expectedContent = new String(bytes);
+ }
+ catch(java.io.IOException e)
+ {
+ fail("Failed to read file " + xmlFileName + ": " + e.getMessage());
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch(Exception ignore)
+ {
+ }
+ }
+ }
+
+ assertXmlEqual(expectedContent, content);
+ }
+
+ /**
+ * Validates XML content passed in the second argument
+ * against the expected XML content passed in the first argument.
+ *
+ * @param expected expected content
+ * @param was the content to validate
+ */
public void assertXmlEqual(String expected, String was)
{
String diff = DIFF.diff(expected, was);
@@ -136,13 +185,91 @@
*/
protected Object unmarshal() throws Exception
{
- String testXsd = findXML(rootName + "_" + getName() + ".xsd");
- SchemaBinding schema = XsdBinder.bind(testXsd, (SchemaBindingResolver)null);
+ String testXsd = rootName + "_" + getName() + ".xsd";
+ SchemaBinding schema = bind(testXsd);
schema.setIgnoreUnresolvedFieldOrClass(false);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- return unmarshaller.unmarshal(findXML(rootName + "_" + getName() + ".xml"), schema);
+ String name = rootName + "_" + getName() + ".xml";
+ return unmarshal(name, schema);
}
+
+ /**
+ * Unmarshall some xml<p>
+ *
+ * The xsd name is UnitTestClass_testName.xsd<p>
+ *
+ * The xml name is UnitTestClass_testName.xml
+ *
+ * @param expected the expected class
+ * @return the object
+ * @throws Exception for any problem
+ */
+ protected Object unmarshal(Class expected) throws Exception
+ {
+ Object object = unmarshal();
+ if (object == null)
+ fail("No object");
+ assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass()));
+ return object;
+ }
+
+ /**
+ * Unmarshal some xml
+ *
+ * @param name the name
+ * @param schema the schema
+ * @return the unmarshalled object
+ * @throws Exception for any error
+ */
+ protected Object unmarshal(String name, SchemaBinding schema) throws Exception
+ {
+ String url = findXML(name);
+ return getJBossXBDelegate().unmarshal(url, schema);
+ }
+
+ /**
+ * Unmarshal some xml
+ *
+ * @param name the name
+ * @param schema the schema
+ * @param expected the expected class
+ * @return the unmarshalled object
+ * @throws Exception for any error
+ */
+ protected Object unmarshal(String name, SchemaBinding schema, Class expected) throws Exception
+ {
+ Object object = unmarshal(name, schema);
+ if (object == null)
+ fail("No object for " + name);
+ assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass()));
+ return object;
+ }
+
+ /**
+ * Bind a schema
+ *
+ * @param name the name
+ * @return the object
+ * @throws Exception for any error
+ */
+ public SchemaBinding bind(String name) throws Exception
+ {
+ return bind(name, null);
+ }
+
+ /**
+ * Bind a schema
+ *
+ * @param name the name
+ * @param resolver the resolver
+ * @return the object
+ * @throws Exception for any error
+ */
+ public SchemaBinding bind(String name, SchemaBindingResolver resolver) throws Exception
+ {
+ String url = findXML(name);
+ return getJBossXBDelegate().bind(url, resolver);
+ }
/**
* Find the xml
Added: jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.java
===================================================================
--- jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.java (rev 0)
+++ jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.xml;
+
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ * @version <tt>$Revision: 46112 $</tt>
+ */
+public class AnyTypeDomBindingUnitTestCase
+ extends AbstractJBossXBTest
+{
+ public AnyTypeDomBindingUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testComplexContentUnmarshalling() throws Exception
+ {
+ SchemaBinding schema = bindSchema();
+
+ Object unmarshalled = unmarshal(rootName + "_complexContent.xml", schema);
+
+ assertNotNull(unmarshalled);
+ assertTrue(unmarshalled instanceof MyType);
+
+ MyType mt = (MyType) unmarshalled;
+
+ assertNotNull(mt.anything);
+ assertTrue(mt.anything.toString(), mt.anything instanceof Element);
+
+ Element dom = (Element) mt.anything;
+ assertEquals("dom", dom.getLocalName());
+ assertEquals(null, dom.getNamespaceURI());
+ assertEquals("test", dom.getTextContent());
+ }
+
+ public void testSimpleContentUnmarshalling() throws Exception
+ {
+ SchemaBinding schema = bindSchema();
+
+ Object unmarshalled = unmarshal(rootName + "_simpleContent.xml", schema);
+
+ assertNotNull(unmarshalled);
+ assertTrue(unmarshalled instanceof MyType);
+
+ MyType mt = (MyType) unmarshalled;
+
+ assertNotNull(mt.anything);
+ assertTrue(mt.anything instanceof String);
+ assertEquals("test", mt.anything);
+ }
+
+ public void testComplexContentMarshalling() throws Exception
+ {
+ SchemaBinding schema = bindSchema();
+
+ DocumentBuilder domBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Element dom = domBuilder.newDocument().createElement("dom");
+ dom.setTextContent("test");
+
+ MyType root = new MyType();
+ root.anything = dom;
+
+ MarshallerImpl marshaller = new MarshallerImpl();
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(schema, null, root, writer);
+
+ assertXmlFileContent(rootName + "_complexContent.xml", writer.getBuffer().toString());
+ }
+
+ public void testSimpleContentMarshalling() throws Exception
+ {
+ SchemaBinding schema = bindSchema();
+
+ DocumentBuilder domBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Element dom = domBuilder.newDocument().createElementNS("http://ns1", "dom");
+ dom.setTextContent("test");
+
+ MyType root = new MyType();
+ root.anything = "test";
+
+ MarshallerImpl marshaller = new MarshallerImpl();
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(schema, null, root, writer);
+
+ assertXmlFileContent(rootName + "_simpleContent.xml", writer.getBuffer().toString());
+ }
+
+ private SchemaBinding bindSchema() throws Exception
+ {
+ SchemaBinding schema = bind(rootName + ".xsd");
+ schema.setIgnoreUnresolvedFieldOrClass(false);
+
+ //schema.setUnresolvedContentBoundToDOM(true);
+ // is true by default and equivalent to
+ /*
+ TypeBinding myType = schema.getType(new QName("http://www.jboss.org/xb/test/any", "myType"));
+ SequenceBinding seq = (SequenceBinding)myType.getParticle().getTerm();
+ ElementBinding anything = (ElementBinding)((ParticleBinding)seq.getParticles().iterator().next()).getTerm();
+ TypeBinding anyType = anything.getType();
+ WildcardBinding wc = anyType.getWildcard();
+
+ wc.setUnresolvedElementHandler(DomParticleHandler.INSTANCE);
+ wc.setUnresolvedCharactersHandler(DomCharactersHandler.INSTANCE);
+ wc.setUnresolvedMarshaller(DomLocalMarshaller.INSTANCE);
+ */
+
+ assertTrue(schema.isUnresolvedContentBoundToDOM());
+
+ return schema;
+ }
+
+ public static class MyType
+ {
+ public Object anything;
+ }
+}
Modified: jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java
===================================================================
--- jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -29,7 +29,9 @@
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
/**
* JBossXBTestDelegate.
@@ -125,4 +127,43 @@
throw e;
}
}
+
+ /**
+ * Unmarshal an object
+ *
+ * @param url the url
+ * @param schema the schema
+ * @return the object
+ * @throws Exception for any error
+ */
+ public Object unmarshal(String url, SchemaBinding schema) throws Exception
+ {
+ long start = System.currentTimeMillis();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+ log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
+ try
+ {
+ Object result = unmarshaller.unmarshal(url, schema);
+ log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+ return result;
+ }
+ catch (Exception e)
+ {
+ log.debug("Error during parsing: " + url, e);
+ throw e;
+ }
+ }
+
+ /**
+ * Bind a schema
+ *
+ * @param url the url
+ * @param resolver the resolver
+ * @return the object
+ * @throws Exception for any error
+ */
+ public SchemaBinding bind(String url, SchemaBindingResolver resolver) throws Exception
+ {
+ return XsdBinder.bind(url, resolver);
+ }
}
Modified: jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsUnitTestCase.java
===================================================================
--- jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsUnitTestCase.java 2007-04-05 15:12:51 UTC (rev 2366)
+++ jbossxb/branches/1_0/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsUnitTestCase.java 2007-04-05 15:46:02 UTC (rev 2367)
@@ -58,18 +58,19 @@
import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
-import org.jboss.xb.util.Dom2Sax;
+import org.jboss.xb.util.DomCharactersHandler;
+import org.jboss.xb.util.DomLocalMarshaller;
+import org.jboss.xb.util.DomParticleHandler;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
import org.w3c.dom.ls.LSInput;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
+
/**
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
* @version <tt>$Revision: 46112 $</tt>
@@ -190,25 +191,7 @@
private void setupDomMarshaller(AbstractMarshaller marshaller)
{
marshaller.mapClassToGlobalElement(ArrayOfAny.class, "e", "http://org.jboss.ws/jbws434/types", null, null);
- marshaller.mapFieldToWildcard(ArrayOfAny.class, "_any",
- new ObjectLocalMarshaller()
- {
- public void marshal(MarshallingContext ctx, Object o)
- {
- Element e = (Element)o;
-
- ContentHandler ch = ctx.getContentHandler();
- try
- {
- Dom2Sax.dom2sax(e, ch);
- }
- catch (SAXException e1)
- {
- throw new JBossXBRuntimeException("Failed to SAX the DOM");
- }
- }
- }
- );
+ marshaller.mapFieldToWildcard(ArrayOfAny.class, "_any", DomLocalMarshaller.INSTANCE);
}
private void setupGeMarshaller(AbstractMarshaller marshaller)
@@ -291,8 +274,8 @@
}
else
{
- unresolvedElementHandler = new DomElementHandler();
- unresolvedCharactersHandler = new DomCharactersHandler();
+ unresolvedElementHandler = DomParticleHandler.INSTANCE;
+ unresolvedCharactersHandler = DomCharactersHandler.INSTANCE;
}
wildcard.setUnresolvedElementHandler(unresolvedElementHandler);
@@ -926,99 +909,4 @@
}
}
}
-
- public static class DomCharactersHandler
- extends CharactersHandler
- {
- public Object unmarshalEmpty(QName qName,
- TypeBinding typeBinding,
- NamespaceContext nsCtx,
- ValueMetaData valueMetaData)
- {
- return "";
- }
-
- public Object unmarshal(QName qName,
- TypeBinding typeBinding,
- NamespaceContext nsCtx,
- ValueMetaData valueMetaData,
- String value)
- {
- return value;
- }
-
- public void setValue(QName qName, ElementBinding element, Object owner, Object value)
- {
- Element e = (Element)owner;
- Text textNode = e.getOwnerDocument().createTextNode((String)value);
- e.appendChild(textNode);
- }
- }
-
- public static class DomElementHandler
- extends RtElementHandler
- implements ParticleHandler
- {
- private Document doc;
-
- public Object startParticle(Object parent,
- QName elementName,
- ParticleBinding particle,
- Attributes attrs,
- NamespaceContext nsCtx)
- {
- Document doc = getDocument();
- Element element = doc.createElementNS(elementName.getNamespaceURI(), elementName.getLocalPart());
-
- if(attrs != null)
- {
- for(int i = 0; i < attrs.getLength(); ++i)
- {
- element.setAttribute(attrs.getLocalName(i), attrs.getValue(i));
- }
- }
-
- return element;
- }
-
- public Object endParticle(Object o, QName elementName, ParticleBinding particle)
- {
- return o;
- }
-
- public void setParent(Object parent,
- Object o,
- QName elementName,
- ParticleBinding particle,
- ParticleBinding parentParticle)
- {
- if(parent instanceof Element)
- {
- ((Element)parent).appendChild((Element)o);
- }
- else
- {
- super.setParent(parent, o, elementName, particle, parentParticle);
- }
- }
-
- private Document getDocument()
- {
- if(doc == null)
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder domBuilder = null;
- try
- {
- domBuilder = factory.newDocumentBuilder();
- }
- catch(ParserConfigurationException e)
- {
- throw new JBossXBRuntimeException("Failed to create document builder instance", e);
- }
- doc = domBuilder.newDocument();
- }
- return doc;
- }
- }
}
Added: jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.xsd
===================================================================
--- jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.xsd (rev 0)
+++ jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.xsd 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,17 @@
+<schema
+ targetNamespace='http://www.jboss.org/xb/test/any'
+ xmlns='http://www.w3.org/2001/XMLSchema'
+ xmlns:jbxb='http://www.jboss.org/xml/ns/jbxb'
+ xmlns:tns='http://www.jboss.org/xb/test/any'>
+ <complexType name='myType'>
+ <annotation>
+ <appinfo>
+ <jbxb:class impl='org.jboss.test.xml.AnyTypeDomBindingUnitTestCase$MyType'/>
+ </appinfo>
+ </annotation>
+ <sequence>
+ <element name='anything' nillable='true' type='anyType'/>
+ </sequence>
+ </complexType>
+ <element name='e' type='tns:myType'/>
+</schema>
Added: jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_complexContent.xml
===================================================================
--- jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_complexContent.xml (rev 0)
+++ jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_complexContent.xml 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,3 @@
+<e xmlns='http://www.jboss.org/xb/test/any'>
+ <anything xmlns=""><dom>test</dom></anything>
+</e>
Added: jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_simpleContent.xml
===================================================================
--- jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_simpleContent.xml (rev 0)
+++ jbossxb/branches/1_0/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_simpleContent.xml 2007-04-05 15:46:02 UTC (rev 2367)
@@ -0,0 +1,3 @@
+<e xmlns='http://www.jboss.org/xb/test/any'>
+ <anything xmlns="">test</anything>
+</e>
More information about the jboss-svn-commits
mailing list