Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLAttributes#setSpecified()
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.XMLAttributes#setSpecified() .
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: XMLDocumentFragmentScannerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 2
Source File: XMLDocumentFragmentScannerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 3
Source File: XMLDocumentFragmentScannerImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName); } else { String name = fEntityScanner.scanName(); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=')) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 4
Source File: XMLDocumentFragmentScannerImpl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 5
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 6
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 7
Source File: XMLDocumentFragmentScannerImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 8
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName, NameType.ATTRIBUTENAME); } else { String name = fEntityScanner.scanName(NameType.ATTRIBUTENAME); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=', NameType.ATTRIBUTE)) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname, false); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 9
Source File: XMLDocumentFragmentScannerImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName); } else { String name = fEntityScanner.scanName(); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=')) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC, fCurrentElement.rawname); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 10
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName); } else { String name = fEntityScanner.scanName(); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=')) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }
Example 11
Source File: XMLDocumentFragmentScannerImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Scans an attribute name value pair. * <p> * <pre> * [41] Attribute ::= Name Eq AttValue * </pre> * <p> * <strong>Note:</strong> This method assumes that the next * character on the stream is the first character of the attribute * name. * <p> * <strong>Note:</strong> This method uses the fAttributeQName and * fQName variables. The contents of these variables will be * destroyed. * * @param attributes The attributes list for the scanned attribute. */ protected void scanAttribute(XMLAttributes attributes) throws IOException, XNIException { if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()"); // name if (fNamespaces) { fEntityScanner.scanQName(fAttributeQName); } else { String name = fEntityScanner.scanName(); fAttributeQName.setValues(null, name, name, null); } // equals fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=')) { reportFatalError("EqRequiredInAttribute", new Object[] {fCurrentElement.rawname, fAttributeQName.rawname}); } fEntityScanner.skipSpaces(); int attIndex = 0 ; //REVISIT: one more case needs to be included: external PE and standalone is no boolean isVC = fHasExternalDTD && !fStandalone; //fTempString would store attribute value ///fTempString2 would store attribute non-normalized value //this function doesn't use 'attIndex'. We are adding the attribute later //after we have figured out that current attribute is not namespace declaration //since scanAttributeValue doesn't use attIndex parameter therefore we //can safely add the attribute later.. XMLString tmpStr = getString(); scanAttributeValue(tmpStr, fTempString2, fAttributeQName.rawname, attributes, attIndex, isVC); // content int oldLen = attributes.getLength(); //if the attribute name already exists.. new value is replaced with old value attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); // WFC: Unique Att Spec //attributes count will be same if the current attribute name already exists for this element name. //this means there are two duplicate attributes. if (oldLen == attributes.getLength()) { reportFatalError("AttributeNotUnique", new Object[]{fCurrentElement.rawname, fAttributeQName.rawname}); } //tmpString contains attribute value //we are passing null as the attribute value attributes.setValue(attIndex, null, tmpStr); ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM //attributes.setNonNormalizedValue(oldLen, fTempString2.toString()); attributes.setSpecified(attIndex, true); if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()"); }