com.sun.org.apache.xerces.internal.util.DOMUtil Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.util.DOMUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSAttributeChecker.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #2
Source File: XSAttributeChecker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #3
Source File: XSAttributeChecker.java From Bytecoder with Apache License 2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #4
Source File: XSAttributeChecker.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #5
Source File: XSDHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Extract location information from an Element node, store such * information in the passed-in SimpleLocator object, then return * true. Returning false means can't extract or store such information. */ public boolean element2Locator(Element e, SimpleLocator l) { if (l == null) return false; if (e instanceof ElementImpl) { ElementImpl ele = (ElementImpl)e; // get system id from document object Document doc = ele.getOwnerDocument(); String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc)); // line/column numbers are stored in the element node int line = ele.getLineNumber(); int column = ele.getColumnNumber(); l.setValues(sid, sid, line, column, ele.getCharacterOffset()); return true; } return false; }
Example #6
Source File: XSAttributeChecker.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #7
Source File: XSAttributeChecker.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void resolveNamespace(Element element, Attr[] attrs, SchemaNamespaceSupport nsSupport) { // push the namespace context nsSupport.pushContext(); // search for new namespace bindings int length = attrs.length; Attr sattr = null; String rawname, prefix, uri; for (int i = 0; i < length; i++) { sattr = attrs[i]; rawname = DOMUtil.getName(sattr); prefix = null; if (rawname.equals(XMLSymbols.PREFIX_XMLNS)) prefix = XMLSymbols.EMPTY_STRING; else if (rawname.startsWith("xmlns:")) prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr)); if (prefix != null) { uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr)); nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null); } } }
Example #8
Source File: XSDHandler.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Extract location information from an Element node, store such * information in the passed-in SimpleLocator object, then return * true. Returning false means can't extract or store such information. */ public boolean element2Locator(Element e, SimpleLocator l) { if (l == null) return false; if (e instanceof ElementImpl) { ElementImpl ele = (ElementImpl)e; // get system id from document object Document doc = ele.getOwnerDocument(); String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc)); // line/column numbers are stored in the element node int line = ele.getLineNumber(); int column = ele.getColumnNumber(); l.setValues(sid, sid, line, column, ele.getCharacterOffset()); return true; } return false; }
Example #9
Source File: XSDHandler.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Extract location information from an Element node, store such * information in the passed-in SimpleLocator object, then return * true. Returning false means can't extract or store such information. */ public boolean element2Locator(Element e, SimpleLocator l) { if (l == null) return false; if (e instanceof ElementImpl) { ElementImpl ele = (ElementImpl)e; // get system id from document object Document doc = ele.getOwnerDocument(); String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc)); // line/column numbers are stored in the element node int line = ele.getLineNumber(); int column = ele.getColumnNumber(); l.setValues(sid, sid, line, column, ele.getCharacterOffset()); return true; } return false; }
Example #10
Source File: XSDAbstractTraverser.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Element/Attribute traversers call this method to check whether * the type is NOTATION without enumeration facet */ void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) { if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE && ((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC && ((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) { if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) { reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem); } } }
Example #11
Source File: XSDComplexTypeTraverser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private boolean isAttrOrAttrGroup(Element e) { String elementName = DOMUtil.getLocalName(e); if (elementName.equals(SchemaSymbols.ELT_ATTRIBUTE) || elementName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP) || elementName.equals(SchemaSymbols.ELT_ANYATTRIBUTE)) return true; else return false; }
Example #12
Source File: XSDHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void setSchemasVisible(XSDocumentInfo startSchema) { if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) { // make it visible DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes); Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema); for (int i = 0; i < dependingSchemas.size(); i++) { setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i)); } } // if it's visible already than so must be its children }
Example #13
Source File: XSDComplexTypeTraverser.java From JDKSourceCode1.8 with MIT License | 5 votes |
private String genAnonTypeName(Element complexTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(complexTypeDecl); while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); }
Example #14
Source File: XSDHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected void storeKeyRef (Element keyrefToStore, XSDocumentInfo schemaDoc, XSElementDecl currElemDecl) { String keyrefName = DOMUtil.getAttrValue(keyrefToStore, SchemaSymbols.ATT_NAME); if (keyrefName.length() != 0) { String keyrefQName = schemaDoc.fTargetNamespace == null? "," + keyrefName: schemaDoc.fTargetNamespace+","+keyrefName; checkForDuplicateNames(keyrefQName, IDENTITYCONSTRAINT_TYPE, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc); } // now set up all the registries we'll need... // check array sizes if (fKeyrefStackPos == fKeyrefs.length) { Element [] elemArray = new Element [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefs, 0, elemArray, 0, fKeyrefStackPos); fKeyrefs = elemArray; XSElementDecl [] declArray = new XSElementDecl [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefElems, 0, declArray, 0, fKeyrefStackPos); fKeyrefElems = declArray; String[][] stringArray = new String [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT][]; System.arraycopy(fKeyrefNamespaceContext, 0, stringArray, 0, fKeyrefStackPos); fKeyrefNamespaceContext = stringArray; XSDocumentInfo [] xsDocumentInfo = new XSDocumentInfo [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefsMapXSDocumentInfo, 0, xsDocumentInfo, 0, fKeyrefStackPos); fKeyrefsMapXSDocumentInfo = xsDocumentInfo; } fKeyrefs[fKeyrefStackPos] = keyrefToStore; fKeyrefElems[fKeyrefStackPos] = currElemDecl; fKeyrefNamespaceContext[fKeyrefStackPos] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext(); fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc; }
Example #15
Source File: XSDHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void setSchemasVisible(XSDocumentInfo startSchema) { if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) { // make it visible DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes); Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema); for (int i = 0; i < dependingSchemas.size(); i++) { setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i)); } } // if it's visible already than so must be its children }
Example #16
Source File: XSDSimpleTypeTraverser.java From JDKSourceCode1.8 with MIT License | 5 votes |
private String genAnonTypeName(Element simpleTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(simpleTypeDecl); while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); }
Example #17
Source File: XSDAbstractTraverser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Element/Attribute traversers call this method to check whether * the type is NOTATION without enumeration facet */ void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) { if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE && ((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC && ((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) { if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) { reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem); } } }
Example #18
Source File: XSDHandler.java From JDKSourceCode1.8 with MIT License | 5 votes |
private void setSchemasVisible(XSDocumentInfo startSchema) { if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) { // make it visible DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes); Vector<XSDocumentInfo> dependingSchemas = fDependencyMap.get(startSchema); for (int i = 0; i < dependingSchemas.size(); i++) { setSchemasVisible(dependingSchemas.elementAt(i)); } } // if it's visible already than so must be its children }
Example #19
Source File: XSDHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private int changeRedefineGroup(String originalQName, String elementSought, String newName, Element curr, XSDocumentInfo schemaDoc) { int result = 0; for (Element child = DOMUtil.getFirstChildElement(curr); child != null; child = DOMUtil.getNextSiblingElement(child)) { String name = DOMUtil.getLocalName(child); if (!name.equals(elementSought)) result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc); else { String ref = child.getAttribute( SchemaSymbols.ATT_REF ); if (ref.length() != 0) { String processedRef = findQName(ref, schemaDoc); if (originalQName.equals(processedRef)) { String prefix = XMLSymbols.EMPTY_STRING; int colonptr = ref.indexOf(":"); if (colonptr > 0) { prefix = ref.substring(0,colonptr); child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName); } else child.setAttribute(SchemaSymbols.ATT_REF, newName); result++; if (elementSought.equals(SchemaSymbols.ELT_GROUP)) { String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS ); String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS ); if (!((maxOccurs.length() == 0 || maxOccurs.equals("1")) && (minOccurs.length() == 0 || minOccurs.equals("1")))) { reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child); } } } } // if ref was null some other stage of processing will flag the error } } return result; }
Example #20
Source File: XSDHandler.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void storeKeyRef (Element keyrefToStore, XSDocumentInfo schemaDoc, XSElementDecl currElemDecl) { String keyrefName = DOMUtil.getAttrValue(keyrefToStore, SchemaSymbols.ATT_NAME); if (keyrefName.length() != 0) { String keyrefQName = schemaDoc.fTargetNamespace == null? "," + keyrefName: schemaDoc.fTargetNamespace+","+keyrefName; checkForDuplicateNames(keyrefQName, IDENTITYCONSTRAINT_TYPE, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc); } // now set up all the registries we'll need... // check array sizes if (fKeyrefStackPos == fKeyrefs.length) { Element [] elemArray = new Element [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefs, 0, elemArray, 0, fKeyrefStackPos); fKeyrefs = elemArray; XSElementDecl [] declArray = new XSElementDecl [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefElems, 0, declArray, 0, fKeyrefStackPos); fKeyrefElems = declArray; String[][] stringArray = new String [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT][]; System.arraycopy(fKeyrefNamespaceContext, 0, stringArray, 0, fKeyrefStackPos); fKeyrefNamespaceContext = stringArray; XSDocumentInfo [] xsDocumentInfo = new XSDocumentInfo [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT]; System.arraycopy(fKeyrefsMapXSDocumentInfo, 0, xsDocumentInfo, 0, fKeyrefStackPos); fKeyrefsMapXSDocumentInfo = xsDocumentInfo; } fKeyrefs[fKeyrefStackPos] = keyrefToStore; fKeyrefElems[fKeyrefStackPos] = currElemDecl; fKeyrefNamespaceContext[fKeyrefStackPos] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext(); fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc; }
Example #21
Source File: XSDHandler.java From JDKSourceCode1.8 with MIT License | 5 votes |
private int changeRedefineGroup(String originalQName, String elementSought, String newName, Element curr, XSDocumentInfo schemaDoc) { int result = 0; for (Element child = DOMUtil.getFirstChildElement(curr); child != null; child = DOMUtil.getNextSiblingElement(child)) { String name = DOMUtil.getLocalName(child); if (!name.equals(elementSought)) result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc); else { String ref = child.getAttribute( SchemaSymbols.ATT_REF ); if (ref.length() != 0) { String processedRef = findQName(ref, schemaDoc); if (originalQName.equals(processedRef)) { String prefix = XMLSymbols.EMPTY_STRING; int colonptr = ref.indexOf(":"); if (colonptr > 0) { prefix = ref.substring(0,colonptr); child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName); } else child.setAttribute(SchemaSymbols.ATT_REF, newName); result++; if (elementSought.equals(SchemaSymbols.ELT_GROUP)) { String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS ); String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS ); if (!((maxOccurs.length() == 0 || maxOccurs.equals("1")) && (minOccurs.length() == 0 || minOccurs.equals("1")))) { reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child); } } } } // if ref was null some other stage of processing will flag the error } } return result; }
Example #22
Source File: XSDComplexTypeTraverser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean isAttrOrAttrGroup(Element e) { String elementName = DOMUtil.getLocalName(e); if (elementName.equals(SchemaSymbols.ELT_ATTRIBUTE) || elementName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP) || elementName.equals(SchemaSymbols.ELT_ANYATTRIBUTE)) return true; else return false; }
Example #23
Source File: XSDHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private int changeRedefineGroup(String originalQName, String elementSought, String newName, Element curr, XSDocumentInfo schemaDoc) { int result = 0; for (Element child = DOMUtil.getFirstChildElement(curr); child != null; child = DOMUtil.getNextSiblingElement(child)) { String name = DOMUtil.getLocalName(child); if (!name.equals(elementSought)) result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc); else { String ref = child.getAttribute( SchemaSymbols.ATT_REF ); if (ref.length() != 0) { String processedRef = findQName(ref, schemaDoc); if (originalQName.equals(processedRef)) { String prefix = XMLSymbols.EMPTY_STRING; int colonptr = ref.indexOf(":"); if (colonptr > 0) { prefix = ref.substring(0,colonptr); child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName); } else child.setAttribute(SchemaSymbols.ATT_REF, newName); result++; if (elementSought.equals(SchemaSymbols.ELT_GROUP)) { String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS ); String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS ); if (!((maxOccurs.length() == 0 || maxOccurs.equals("1")) && (minOccurs.length() == 0 || minOccurs.equals("1")))) { reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child); } } } } // if ref was null some other stage of processing will flag the error } } return result; }
Example #24
Source File: XSDHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void resolveKeyRefs() { for (int i=0; i<fKeyrefStackPos; i++) { XSDocumentInfo keyrefSchemaDoc = fKeyrefsMapXSDocumentInfo[i]; keyrefSchemaDoc.fNamespaceSupport.makeGlobal(); keyrefSchemaDoc.fNamespaceSupport.setEffectiveContext( fKeyrefNamespaceContext[i] ); SchemaGrammar keyrefGrammar = fGrammarBucket.getGrammar(keyrefSchemaDoc.fTargetNamespace); // need to set <keyref> to hidden before traversing it, // because it has global scope DOMUtil.setHidden(fKeyrefs[i], fHiddenNodes); fKeyrefTraverser.traverse(fKeyrefs[i], fKeyrefElems[i], keyrefSchemaDoc, keyrefGrammar); } }
Example #25
Source File: XSDSimpleTypeTraverser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private String genAnonTypeName(Element simpleTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(simpleTypeDecl); while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); }
Example #26
Source File: XSDComplexTypeTraverser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private String genAnonTypeName(Element complexTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(complexTypeDecl); while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); }
Example #27
Source File: XSDComplexTypeTraverser.java From hottub with GNU General Public License v2.0 | 5 votes |
private String genAnonTypeName(Element complexTypeDecl) { // Generate a unique name for the anonymous type by concatenating together the // names of parent nodes // The name is quite good for debugging/error purposes, but we may want to // revisit how this is done for performance reasons (LM). StringBuffer typeName = new StringBuffer("#AnonType_"); Element node = DOMUtil.getParent(complexTypeDecl); while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) { typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME)); node = DOMUtil.getParent(node); } return typeName.toString(); }
Example #28
Source File: XSDHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
private void setSchemasVisible(XSDocumentInfo startSchema) { if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) { // make it visible DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes); Vector<XSDocumentInfo> dependingSchemas = fDependencyMap.get(startSchema); for (int i = 0; i < dependingSchemas.size(); i++) { setSchemasVisible(dependingSchemas.elementAt(i)); } } // if it's visible already than so must be its children }
Example #29
Source File: XSDHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private int changeRedefineGroup(String originalQName, String elementSought, String newName, Element curr, XSDocumentInfo schemaDoc) { int result = 0; for (Element child = DOMUtil.getFirstChildElement(curr); child != null; child = DOMUtil.getNextSiblingElement(child)) { String name = DOMUtil.getLocalName(child); if (!name.equals(elementSought)) result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc); else { String ref = child.getAttribute( SchemaSymbols.ATT_REF ); if (ref.length() != 0) { String processedRef = findQName(ref, schemaDoc); if (originalQName.equals(processedRef)) { String prefix = XMLSymbols.EMPTY_STRING; int colonptr = ref.indexOf(":"); if (colonptr > 0) { prefix = ref.substring(0,colonptr); child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName); } else child.setAttribute(SchemaSymbols.ATT_REF, newName); result++; if (elementSought.equals(SchemaSymbols.ELT_GROUP)) { String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS ); String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS ); if (!((maxOccurs.length() == 0 || maxOccurs.equals("1")) && (minOccurs.length() == 0 || minOccurs.equals("1")))) { reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child); } } } } // if ref was null some other stage of processing will flag the error } } return result; }
Example #30
Source File: XSDComplexTypeTraverser.java From Bytecoder with Apache License 2.0 | 5 votes |
private boolean isAttrOrAttrGroup(Element e) { String elementName = DOMUtil.getLocalName(e); if (elementName.equals(SchemaSymbols.ELT_ATTRIBUTE) || elementName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP) || elementName.equals(SchemaSymbols.ELT_ANYATTRIBUTE)) return true; else return false; }