com.sun.org.apache.xerces.internal.xni.XMLAttributes Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.XMLAttributes.
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: XIncludeHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Search for a xml:base attribute, and if one is found, put the new base URI into * effect. */ protected void processXMLBaseAttributes(XMLAttributes attributes) { String baseURIValue = attributes.getValue(NamespaceContext.XML_URI, "base"); if (baseURIValue != null) { try { String expandedValue = XMLEntityManager.expandSystemId( baseURIValue, fCurrentBaseURI.getExpandedSystemId(), false); fCurrentBaseURI.setLiteralSystemId(baseURIValue); fCurrentBaseURI.setBaseSystemId( fCurrentBaseURI.getExpandedSystemId()); fCurrentBaseURI.setExpandedSystemId(expandedValue); // push the new values on the stack saveBaseURI(); } catch (MalformedURIException e) { // REVISIT: throw error here } } }
Example #2
Source File: XPointerHandler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * An empty element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (!resolveXPointer(element, attributes, augs, XPointerPart.EVENT_ELEMENT_EMPTY)) { // xml:base and xml:lang processing if (fFixupBase) { processXMLBaseAttributes(attributes); } if (fFixupLang) { processXMLLangAttributes(attributes); } // no need to restore restoreBaseURI() for xml:base and xml:lang processing // set the context invalid if the element till an element from the result infoset is included fNamespaceContext.setContextInvalid(); return; } super.emptyElement(element, attributes, augs); }
Example #3
Source File: ValidatorHandlerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (fContentHandler != null) { try { fTypeInfoProvider.beginStartElement(augs, attributes); fContentHandler.startElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING, element.localpart, element.rawname, fAttrAdapter); } catch (SAXException e) { throw new XNIException(e); } finally { fTypeInfoProvider.finishStartElement(); } } }
Example #4
Source File: ValidatorHandlerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (fContentHandler != null) { try { fTypeInfoProvider.beginStartElement(augs, attributes); fContentHandler.startElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING, element.localpart, element.rawname, fAttrAdapter); } catch (SAXException e) { throw new XNIException(e); } finally { fTypeInfoProvider.finishStartElement(); } } }
Example #5
Source File: XPointerHandler.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * An empty element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (!resolveXPointer(element, attributes, augs, XPointerPart.EVENT_ELEMENT_EMPTY)) { // xml:base and xml:lang processing if (fFixupBase) { processXMLBaseAttributes(attributes); } if (fFixupLang) { processXMLLangAttributes(attributes); } // no need to restore restoreBaseURI() for xml:base and xml:lang processing // set the context invalid if the element till an element from the result infoset is included fNamespaceContext.setContextInvalid(); return; } super.emptyElement(element, attributes, augs); }
Example #6
Source File: Selector.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * The start of an element. If the document specifies the start element * by using an empty tag, then the startElement method will immediately * be followed by the endElement method, with no intervening methods. * * @param element The name of the element. * @param attributes The element attributes. * */ public void startElement(QName element, XMLAttributes attributes) { super.startElement(element, attributes); fElementDepth++; // activate the fields, if selector is matched //int matched = isMatched(); if (isMatched()) { /* (fMatchedDepth == -1 && ((matched & MATCHED) == MATCHED)) || ((matched & MATCHED_DESCENDANT) == MATCHED_DESCENDANT)) { */ fMatchedDepth = fElementDepth; fFieldActivator.startValueScopeFor(fIdentityConstraint, fInitialDepth); int count = fIdentityConstraint.getFieldCount(); for (int i = 0; i < count; i++) { Field field = fIdentityConstraint.getFieldAt(i); XPathMatcher matcher = fFieldActivator.activateField(field, fInitialDepth); matcher.startElement(element, attributes); } } }
Example #7
Source File: DTDGrammarUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** Handle element * @return true if validator is removed from the pipeline */ protected void handleStartElement(QName element, XMLAttributes attributes) throws XNIException { if (fDTDGrammar == null) { fCurrentElementIndex = -1; fCurrentContentSpecType = -1; fInElementContent = false; return; } else { fCurrentElementIndex = fDTDGrammar.getElementDeclIndex(element); fCurrentContentSpecType = fDTDGrammar.getContentSpecType( fCurrentElementIndex); //handleDTDDefaultAttrs(element,attributes); addDTDDefaultAttrs(element, attributes); } fInElementContent = fCurrentContentSpecType == XMLElementDecl.TYPE_CHILDREN; fElementDepth++; ensureStackCapacity(fElementDepth); fElementContentState[fElementDepth] = fInElementContent; }
Example #8
Source File: Selector.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * The start of an element. If the document specifies the start element * by using an empty tag, then the startElement method will immediately * be followed by the endElement method, with no intervening methods. * * @param element The name of the element. * @param attributes The element attributes. * */ public void startElement(QName element, XMLAttributes attributes) { super.startElement(element, attributes); fElementDepth++; // activate the fields, if selector is matched //int matched = isMatched(); if (isMatched()) { /* (fMatchedDepth == -1 && ((matched & MATCHED) == MATCHED)) || ((matched & MATCHED_DESCENDANT) == MATCHED_DESCENDANT)) { */ fMatchedDepth = fElementDepth; fFieldActivator.startValueScopeFor(fIdentityConstraint, fInitialDepth); int count = fIdentityConstraint.getFieldCount(); for (int i = 0; i < count; i++) { Field field = fIdentityConstraint.getFieldAt(i); XPathMatcher matcher = fFieldActivator.activateField(field, fInitialDepth); matcher.startElement(element, attributes); } } }
Example #9
Source File: XMLDTDValidator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, augs); } }
Example #10
Source File: XMLNamespaceBinder.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * An empty element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (fNamespaces) { handleStartElement(element, attributes, augs, true); handleEndElement(element, augs, true); } else if (fDocumentHandler != null) { fDocumentHandler.emptyElement(element, attributes, augs); } }
Example #11
Source File: SchemaDOMParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * @param attributes * @return */ private boolean hasNonSchemaAttributes(QName element, XMLAttributes attributes) { final int length = attributes.getLength(); for (int i = 0; i < length; ++i) { String uri = attributes.getURI(i); if (uri != null && uri != SchemaSymbols.URI_SCHEMAFORSCHEMA && uri != NamespaceContext.XMLNS_URI && !(uri == NamespaceContext.XML_URI && attributes.getQName(i) == SchemaSymbols.ATT_XML_LANG && element.localpart == SchemaSymbols.ELT_SCHEMA)) { return true; } } return false; }
Example #12
Source File: XMLSchemaValidator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #13
Source File: XMLNamespaceBinder.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * An empty element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { if (fNamespaces) { handleStartElement(element, attributes, augs, true); handleEndElement(element, augs, true); } else if (fDocumentHandler != null) { fDocumentHandler.emptyElement(element, attributes, augs); } }
Example #14
Source File: SchemaDOM.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public ElementImpl startElement(QName element, XMLAttributes attributes, int line, int column, int offset) { ElementImpl node = new ElementImpl(line, column, offset); processElement(element, attributes, node); // now the current node added, becomes the parent parent = node; return node; }
Example #15
Source File: SchemaDOM.java From JDKSourceCode1.8 with MIT License | 5 votes |
void startAnnotationElement(String elemRawName, XMLAttributes attributes) { fAnnotationBuffer.append("<").append(elemRawName); for(int i=0; i<attributes.getLength(); i++) { String aValue = attributes.getValue(i); fAnnotationBuffer.append(" ").append(attributes.getQName(i)).append("=\"").append(processAttValue(aValue)).append("\""); } fAnnotationBuffer.append(">"); }
Example #16
Source File: ElementSchemePointer.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Responsible for resolving the element() scheme XPointer. If a ShortHand * Pointer is present and it is successfully resolved and if a child * sequence is present, the child sequence is resolved relative to it. * * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#resolveXPointer(com.sun.org.apache.xerces.internal.xni.QName, com.sun.org.apache.xerces.internal.xni.XMLAttributes, com.sun.org.apache.xerces.internal.xni.Augmentations, int event) */ public boolean resolveXPointer(QName element, XMLAttributes attributes, Augmentations augs, int event) throws XNIException { boolean isShortHandPointerResolved = false; // if a ChildSequence exisits, resolve child elements // if an element name exists if (fShortHandPointerName != null) { // resolve ShortHand Pointer isShortHandPointerResolved = fShortHandPointer.resolveXPointer( element, attributes, augs, event); if (isShortHandPointerResolved) { fIsResolveElement = true; fIsShortHand = true; } else { fIsResolveElement = false; } } else { fIsResolveElement = true; } // Added here to skip the ShortHand pointer corresponding to // an element if one exisits and start searching from its child if (fChildSequence.length > 0) { fIsFragmentResolved = matchChildSequence(element, event); } else if (isShortHandPointerResolved && fChildSequence.length <= 0) { // if only a resolved shorthand pointer exists fIsFragmentResolved = isShortHandPointerResolved; } else { fIsFragmentResolved = false; } return fIsFragmentResolved; }
Example #17
Source File: DOMParserImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * The start of an element. If the document specifies the start element * by using an empty tag, then the startElement method will immediately * be followed by the endElement method, with no intervening methods. * Overriding the parent to handle DOM_NAMESPACE_DECLARATIONS=false. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement (QName element, XMLAttributes attributes, Augmentations augs) { // namespace declarations parameter has no effect if namespaces is false. if (!fNamespaceDeclarations && fNamespaceAware) { int len = attributes.getLength(); for (int i = len - 1; i >= 0; --i) { if (XMLSymbols.PREFIX_XMLNS == attributes.getPrefix(i) || XMLSymbols.PREFIX_XMLNS == attributes.getQName(i)) { attributes.removeAttributeAt(i); } } } super.startElement(element, attributes, augs); }
Example #18
Source File: ShortHandPointer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public boolean resolveXPointer(QName element, XMLAttributes attributes, Augmentations augs, int event) throws XNIException { // reset fIsFragmentResolved if (fMatchingChildCount == 0) { fIsFragmentResolved = false; } // On startElement or emptyElement, if no matching elements or parent // elements were found, check for a matching idenfitier. if (event == XPointerPart.EVENT_ELEMENT_START) { if (fMatchingChildCount == 0) { fIsFragmentResolved = hasMatchingIdentifier(element, attributes, augs, event); } if (fIsFragmentResolved) { fMatchingChildCount++; } } else if (event == XPointerPart.EVENT_ELEMENT_EMPTY) { if (fMatchingChildCount == 0) { fIsFragmentResolved = hasMatchingIdentifier(element, attributes, augs, event); } } else { // On endElement, decrease the matching child count if the child or // its parent was resolved. if (fIsFragmentResolved) { fMatchingChildCount--; } } return fIsFragmentResolved ; }
Example #19
Source File: ShortHandPointer.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Rerturns the DTD determine-ID * * @param attributes * @param index * @return String * @throws XNIException */ public String getDTDDeterminedID(XMLAttributes attributes, int index) throws XNIException { if (attributes.getType(index).equals("ID")) { return attributes.getValue(index); } return null; }
Example #20
Source File: XMLSchemaValidator.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #21
Source File: ShortHandPointer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Returns the schema-determined-ID. * * * @param attributes * @param index * @return A String containing the schema-determined ID. * @throws XNIException */ public String getSchemaDeterminedID(XMLAttributes attributes, int index) throws XNIException { Augmentations augs = attributes.getAugmentations(index); AttributePSVI attrPSVI = (AttributePSVI) augs .getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { // An element or attribute information item is a schema-determined // ID if and only if one of the following is true:] // 1. It has a [member type definition] or [type definition] property // whose value in turn has [name] equal to ID and [target namespace] // equal to http://www.w3.org/2001/XMLSchema; // 2. It has a [base type definition] whose value has that [name] and [target namespace]; // 3. It has a [base type definition] whose value has a [base type definition] // whose value has that [name] and [target namespace], and so on following // the [base type definition] property recursively; XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition(); if (typeDef != null) { typeDef = attrPSVI.getTypeDefinition(); } // if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) { return attrPSVI.getSchemaNormalizedValue(); } // 4 & 5 NA } return null; }
Example #22
Source File: XMLSchemaValidator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #23
Source File: XMLSchemaValidator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #24
Source File: ShortHandPointer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Rerturns the DTD determine-ID * * @param attributes * @param index * @return String * @throws XNIException */ public String getDTDDeterminedID(XMLAttributes attributes, int index) throws XNIException { if (attributes.getType(index).equals("ID")) { return attributes.getValue(index); } return null; }
Example #25
Source File: ShortHandPointer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Returns the schema-determined-ID. * * * @param attributes * @param index * @return A String containing the schema-determined ID. * @throws XNIException */ public String getSchemaDeterminedID(XMLAttributes attributes, int index) throws XNIException { Augmentations augs = attributes.getAugmentations(index); AttributePSVI attrPSVI = (AttributePSVI) augs .getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { // An element or attribute information item is a schema-determined // ID if and only if one of the following is true:] // 1. It has a [member type definition] or [type definition] property // whose value in turn has [name] equal to ID and [target namespace] // equal to http://www.w3.org/2001/XMLSchema; // 2. It has a [base type definition] whose value has that [name] and [target namespace]; // 3. It has a [base type definition] whose value has a [base type definition] // whose value has that [name] and [target namespace], and so on following // the [base type definition] property recursively; XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition(); if (typeDef != null) { typeDef = attrPSVI.getTypeDefinition(); } // if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) { return attrPSVI.getSchemaNormalizedValue(); } // 4 & 5 NA } return null; }
Example #26
Source File: XMLSchemaValidator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #27
Source File: XMLSchemaValidator.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Augmentations modifiedAugs = handleStartElement(element, attributes, augs); // call handlers if (fDocumentHandler != null) { fDocumentHandler.startElement(element, attributes, modifiedAugs); } }
Example #28
Source File: ValidatorHandlerImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { /** Split empty element event. **/ startElement(element, attributes, augs); endElement(element, augs); }
Example #29
Source File: AttributesProxy.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public AttributesProxy(XMLAttributes attributes) { fAttributes = attributes; }
Example #30
Source File: SchemaDOMParser.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { fDepth++; // while it is true that non-whitespace character data // may only occur in appInfo or documentation // elements, it's certainly legal for comments and PI's to // occur as children of annotation; we need // to account for these here. if (fAnnotationDepth == -1) { if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && element.localpart == SchemaSymbols.ELT_ANNOTATION) { if (fGenerateSyntheticAnnotation) { if (fSawAnnotation.size() > 0) { fSawAnnotation.pop(); } fSawAnnotation.push(true); } fAnnotationDepth = fDepth; schemaDOM.startAnnotation(element, attributes, fNamespaceContext); fCurrentAnnotationElement = schemaDOM.startElement(element, attributes, fLocator.getLineNumber(), fLocator.getColumnNumber(), fLocator.getCharacterOffset()); return; } else if (element.uri == SchemaSymbols.URI_SCHEMAFORSCHEMA && fGenerateSyntheticAnnotation) { fSawAnnotation.push(false); fHasNonSchemaAttributes.push(hasNonSchemaAttributes(element, attributes)); } } else if (fDepth == fAnnotationDepth + 1) { fInnerAnnotationDepth = fDepth; schemaDOM.startAnnotationElement(element, attributes); } else { schemaDOM.startAnnotationElement(element, attributes); // avoid falling through; don't call startElement in this case return; } schemaDOM.startElement(element, attributes, fLocator.getLineNumber(), fLocator.getColumnNumber(), fLocator.getCharacterOffset()); }