Author: mukulg
Date: Sat Jan 30 15:04:01 2010
New Revision: 904783
URL: http://svn.apache.org/viewvc?rev=904783&view=rev
Log:
adding ability to serialize attributes on a global complex type declaration.
Modified:
xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java
Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java?rev=904783&r1=904782&r2=904783&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java Sat
Jan 30 15:04:01 2010
@@ -221,6 +221,10 @@
complxTypeDomNode,
particle);
}
+
+ // add attributes to complex type
+ addAttributesToComplexType(document, complexTypeDecl,
+ complxTypeDomNode);
}
} // end of, processGlobalComplexTypeDecl
@@ -408,21 +412,32 @@
processParticleFromComplexType(document, complexTypeDomNode,
particle);
}
- // iterate all attributes on the Complex type.
- // all attributes on a complex type (from all of xs:attribute &
xs:attributeGroup
- // declarations) are expanded, into an XSObjectList list.
- XSObjectList attributeUses = complexTypeDecl.getAttributeUses();
- for (int attrUsesIdx = 0; attrUsesIdx < attributeUses.getLength();
attrUsesIdx++) {
- XSAttributeUse attrUse = (XSAttributeUse)
attributeUses.item(attrUsesIdx);
- XSAttributeDecl attrDecl = (XSAttributeDecl)
attrUse.getAttrDeclaration();
- addAttributeToSchemaComponent(document, complexTypeDomNode,
attrDecl);
- }
+ // add attributes to the complex type
+ addAttributesToComplexType(document, complexTypeDecl,
complexTypeDomNode);
//XSWildcard attrWildCard = complexTypeDecl.getAttributeWildcard();
} // end of, processAnonComplexTypeOnElement
/*
+ * Add attributes to the complex type
+ */
+ private void addAttributesToComplexType(Document document,
+ XSComplexTypeDecl complexTypeDecl,
+ Element complexTypeDomNode)
+ throws DOMException {
+ // iterate all attributes on the Complex type.
+ // all attributes on a complex type (from all of xs:attribute &
xs:attributeGroup
+ // declarations) are expanded, into an XSObjectList list.
+ XSObjectList attributeUses = complexTypeDecl.getAttributeUses();
+ for (int attrUsesIdx = 0; attrUsesIdx < attributeUses.getLength();
attrUsesIdx++) {
+ XSAttributeUse attrUse = (XSAttributeUse)
attributeUses.item(attrUsesIdx);
+ XSAttributeDecl attrDecl = (XSAttributeDecl)
attrUse.getAttrDeclaration();
+ addAttributeToSchemaComponent(document, complexTypeDomNode,
attrDecl);
+ }
+ }
+
+ /*
* Processing a "particle" from a complex type
*/
private void processParticleFromComplexType(Document document,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]