Revision: 521
Author:
joe.b...@gmail.com
Date: Fri Dec 5 21:42:07 2014 UTC
Log: (Issue 157) When converting interim XMLType to model Type, add
the newly minted ComplexTypeImpl to the outBag before processing its
baseType.
https://code.google.com/p/genxdm/source/detail?r=521
Modified:
/trunk/project/bridgekit/src/main/java/org/genxdm/bridgekit/xs/complex/ComplexTypeImpl.java
/trunk/project/processor.w3c.xs/src/main/java/org/genxdm/processor/w3c/xs/impl/XMLSchemaConverter.java
=======================================
---
/trunk/project/bridgekit/src/main/java/org/genxdm/bridgekit/xs/complex/ComplexTypeImpl.java
Tue May 15 16:53:09 2012 UTC
+++
/trunk/project/bridgekit/src/main/java/org/genxdm/bridgekit/xs/complex/ComplexTypeImpl.java
Fri Dec 5 21:42:07 2014 UTC
@@ -50,7 +50,7 @@
super(PreCondition.assertArgumentNotNull(name, "name"),
isAnonymous, scope, derivation);
this.isNative = isNative;
this.m_atoms = PreCondition.assertArgumentNotNull(atoms, "atoms");
- m_baseType =
PreCondition.assertArgumentNotNull(baseType, "baseType");
+ m_baseType = baseType; //
PreCondition.assertArgumentNotNull(baseType, "baseType");
m_contentType =
PreCondition.assertArgumentNotNull(contentType, "contentType");
m_block = PreCondition.assertArgumentNotNull(block, "block");
m_blockUnmodifiable = Collections.unmodifiableSet(m_block);
@@ -82,7 +82,10 @@
{
return m_baseType;
}
-
+ public void setBaseType(Type baseType)
+ {
+ m_baseType = baseType;
+ }
public ContentType getContentType()
{
return m_contentType;
@@ -263,7 +266,7 @@
* {attribute wildcard} is mutable
*/
private SchemaWildcard m_attributeWildcard = null;
- private final Type m_baseType;
+ private Type m_baseType;
private final Set<DerivationMethod> m_block;
=======================================
---
/trunk/project/processor.w3c.xs/src/main/java/org/genxdm/processor/w3c/xs/impl/XMLSchemaConverter.java
Mon Nov 10 16:18:03 2014 UTC
+++
/trunk/project/processor.w3c.xs/src/main/java/org/genxdm/processor/w3c/xs/impl/XMLSchemaConverter.java
Fri Dec 5 21:42:07 2014 UTC
@@ -16,6 +16,7 @@
package org.genxdm.processor.w3c.xs.impl;
import java.math.BigInteger;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
@@ -308,9 +309,9 @@
/**
* Expand temporary variables used to hold syntactic constructs for
attribute uses and wildcards.
*/
- private Map<QName, AttributeUse> computeAttributeUses(final XMLType
complexType) throws AbortException, SchemaException
+ private Map<QName, AttributeUse> computeAttributeUses(final XMLType
complexType, final Map<QName, AttributeUse> attributeUses) throws
AbortException, SchemaException
{
- final HashMap<QName, AttributeUse> attributeUses = new
HashMap<QName, AttributeUse>();
+// final HashMap<QName, AttributeUse> attributeUses = new
HashMap<QName, AttributeUse>();
for (final XMLAttributeUse attributeUse :
complexType.getAttributeUses())
{
@@ -838,23 +839,20 @@
try
{
- final Map<QName, AttributeUse> attributeUses =
computeAttributeUses(xmlComplexType);
- final Type baseType = convertType(xmlComplexType.getBaseRef());
+ final Map<QName, AttributeUse> attributeUses = new
HashMap<QName,AttributeUse>();
// Constructing and registering the complex type allows it to
be
// referenced in the {content type} property.
final ComplexTypeImpl complexType;
- if (null != attributeUses)
- {
- complexType = new ComplexTypeImpl(outName, false,
isAnonymous, scope, baseType, xmlComplexType.getDerivationMethod(),
attributeUses, EMPTY_CONTENT, xmlComplexType.getBlock(),
m_existingCache.getAtomicType(NativeType.UNTYPED_ATOMIC));
- }
- else
- {
- complexType = new ComplexTypeImpl(outName, false,
isAnonymous, scope, baseType, xmlComplexType.getDerivationMethod(), null,
EMPTY_CONTENT, xmlComplexType.getBlock(),
m_existingCache.getAtomicType(NativeType.UNTYPED_ATOMIC));
- }
+ complexType = new ComplexTypeImpl(outName, false, isAnonymous,
scope, null, xmlComplexType.getDerivationMethod(), attributeUses,
EMPTY_CONTENT, xmlComplexType.getBlock(),
m_existingCache.getAtomicType(NativeType.UNTYPED_ATOMIC));
+
m_outBag.add(complexType);
m_locations.m_complexTypeLocations.put(complexType,
xmlComplexType.getLocation());
-
+
+ final Type baseType = convertType(xmlComplexType.getBaseRef());
+ complexType.setBaseType(baseType);
+
+ computeAttributeUses(xmlComplexType, attributeUses);
complexType.setContentType(convertContentType(xmlComplexType));
complexType.setAbstract(xmlComplexType.isAbstract());
@@ -879,11 +877,16 @@
copyForeignAttributes(xmlComplexType.foreignAttributes,
complexType);
return complexType;
}
+ catch (Exception ex){
+ System.out.println("ex: " + ex.getMessage());
+ throw new RuntimeException(ex);
+ }
finally
{
if (scope == ScopeExtent.Global)
{
- m_cycles.types.pop();
+
System.out.println("XMLSchemaConverter.convertComplexType[2]: popping
type: " + m_cycles.types.pop());
+// m_cycles.types.pop();
}
}
}