1 57 58 package com.sun.org.apache.xerces.internal.impl.xs.traversers; 59 60 import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar; 61 import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols; 62 import com.sun.org.apache.xerces.internal.impl.xs.XSAnnotationImpl; 63 import com.sun.org.apache.xerces.internal.impl.xs.XSNotationDecl; 64 import com.sun.org.apache.xerces.internal.util.DOMUtil; 65 import org.w3c.dom.Element ; 66 67 83 class XSDNotationTraverser extends XSDAbstractTraverser { 84 85 XSDNotationTraverser (XSDHandler handler, 86 XSAttributeChecker gAttrCheck) { 87 super(handler, gAttrCheck); 88 } 89 90 XSNotationDecl traverse(Element elmNode, 91 XSDocumentInfo schemaDoc, 92 SchemaGrammar grammar) { 93 94 Object [] attrValues = fAttrChecker.checkAttributes(elmNode, true, schemaDoc); 96 String nameAttr = (String ) attrValues[XSAttributeChecker.ATTIDX_NAME]; 98 99 String publicAttr = (String ) attrValues[XSAttributeChecker.ATTIDX_PUBLIC]; 100 String systemAttr = (String ) attrValues[XSAttributeChecker.ATTIDX_SYSTEM]; 101 if (nameAttr == null) { 102 reportSchemaError("s4s-att-must-appear", new Object []{SchemaSymbols.ELT_NOTATION, SchemaSymbols.ATT_NAME}, elmNode); 103 fAttrChecker.returnAttrArray(attrValues, schemaDoc); 104 return null; 105 } 106 107 if (systemAttr == null && publicAttr == null) 108 reportSchemaError("s4s-att-must-appear", new Object []{SchemaSymbols.ELT_NOTATION, "system or public"}, elmNode); 109 XSNotationDecl notation = new XSNotationDecl(); 110 notation.fName = nameAttr; 111 notation.fTargetNamespace = schemaDoc.fTargetNamespace; 112 notation.fPublicId = publicAttr; 113 notation.fSystemId = systemAttr; 114 115 Element content = DOMUtil.getFirstChildElement(elmNode); 117 XSAnnotationImpl annotation = null; 118 119 if (content != null) { 120 if (DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_ANNOTATION)) { 122 annotation = traverseAnnotationDecl(content, attrValues, false, schemaDoc); 123 content = DOMUtil.getNextSiblingElement(content); 124 } 125 } 126 notation.fAnnotation = annotation; 127 if (content!=null){ 128 Object [] args = new Object [] {SchemaSymbols.ELT_NOTATION, "(annotation?)", DOMUtil.getLocalName(content)}; 129 reportSchemaError("s4s-elt-must-match.1", args, content); 130 131 } 132 grammar.addGlobalNotationDecl(notation); 133 fAttrChecker.returnAttrArray(attrValues, schemaDoc); 134 135 return notation; 136 } 137 } 138 | Popular Tags |