You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2010/02/20 11:54:21 UTC

svn commit: r912100 - /xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java

Author: mukulg
Date: Sat Feb 20 10:54:21 2010
New Revision: 912100

URL: http://svn.apache.org/viewvc?rev=912100&view=rev
Log:
some more serialization improvements, for annotations

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=912100&r1=912099&r2=912100&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 Feb 20 10:54:21 2010
@@ -68,8 +68,6 @@
  * XSModel serialization utility.
  * This utility serializes the Xerces XSModel into lexical, XSD syntax.
  * 
- * This is a work in progress.
- * 
  * @author Mukul Gandhi, IBM
  * @version $Id$
  */
@@ -367,13 +365,22 @@
                 idConsDomNode.setAttributeNS(null, "refer", idReferStr);  
              }
              
+             // add annotation to an ID constraint
+             XSAnnotationImpl idConsAnnotation = (XSAnnotationImpl) 
+                                                   idCons.getAnnotations().item(0);
+             if (idConsAnnotation != null) {
+                addAnnotationToSchemaComponent(document, 
+                                               idConsDomNode, 
+                                               idConsAnnotation);
+             }
+             
              Selector idSelector = idCons.getSelector();
              String selectorXPathStr = idSelector.getXPath().toString();
              Element selectorDomNode = document.createElementNS(XSD_LANGUAGE_URI,
                                                               XSD_LANGUAGE_PREFIX
                                                               + "selector");
              selectorDomNode.setAttributeNS(null, "xpath", selectorXPathStr);
-             idConsDomNode.appendChild(selectorDomNode);
+             idConsDomNode.appendChild(selectorDomNode);             
              
              for (int fieldIdx = 0; fieldIdx < idCons.getFieldCount(); fieldIdx++) {
                 Field field = idCons.getFieldAt(fieldIdx);
@@ -1257,9 +1264,9 @@
         DocumentBuilderFactory annotationDbf = DocumentBuilderFactory.newInstance();
         Element annotationElement = null;
         try {
-          DocumentBuilder annotationDb = annotationDbf.newDocumentBuilder();
-          Document annotationDom = annotationDb.parse(annotationInputSrc);
-          annotationElement = (Element) document.importNode
+           DocumentBuilder annotationDb = annotationDbf.newDocumentBuilder();
+           Document annotationDom = annotationDb.parse(annotationInputSrc);
+           annotationElement = (Element) document.importNode
                                  (annotationDom.getDocumentElement(), true);
         }
         catch(Exception ex) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org