本文整理汇总了Java中org.apache.xerces.xni.XMLAttributes类的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributes类的具体用法?Java XMLAttributes怎么用?Java XMLAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLAttributes类属于org.apache.xerces.xni包,在下文中一共展示了XMLAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Info
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* Creates an element information object.
* <p>
* <strong>Note:</strong>
* This constructor makes a copy of the element information.
*
* @param element The element qualified name.
* @param attributes The element attributes.
*/
public Info(HTMLElements.Element element,
QName qname, XMLAttributes attributes) {
this.element = element;
this.qname = new QName(qname);
if (attributes != null) {
int length = attributes.getLength();
if (length > 0) {
QName aqname = new QName();
XMLAttributes newattrs = new XMLAttributesImpl();
for (int i = 0; i < length; i++) {
attributes.getName(i, aqname);
String type = attributes.getType(i);
String value = attributes.getValue(i);
String nonNormalizedValue = attributes.getNonNormalizedValue(i);
boolean specified = attributes.isSpecified(i);
newattrs.addAttribute(aqname, type, value);
newattrs.setNonNormalizedValue(i, nonNormalizedValue);
newattrs.setSpecified(i, specified);
}
this.attributes = newattrs;
}
}
}
示例2: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
public void startElement(QName element, XMLAttributes attributes,
Augmentations augs) throws XNIException {
try {
int length = attributes.getLength();
if (length == 0) {
/** Avoid creating a new StartElement event object (if possible). */
XMLEvent start = fStAXValidatorHelper.getCurrentEvent();
if (start != null) {
fEventWriter.add(start);
return;
}
}
fEventWriter.add(fEventFactory.createStartElement(element.prefix,
element.uri != null ? element.uri : "", element.localpart,
getAttributeIterator(attributes, length), getNamespaceIterator(),
fNamespaceContext.getNamespaceContext()));
}
catch (XMLStreamException e) {
throw new XNIException(e);
}
}
示例3: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
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();
}
}
}
示例4: emptyElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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 {
Augmentations modifiedAugs = handleStartElement(element, attributes, augs);
// in the case where there is a {value constraint}, and the element
// doesn't have any text content, change emptyElement call to
// start + characters + end
fDefaultValue = null;
// fElementDepth == -2 indicates that the schema validator was removed
// from the pipeline. then we don't need to call handleEndElement.
if (fElementDepth != -2)
modifiedAugs = handleEndElement(element, modifiedAugs);
// call handlers
if (fDocumentHandler != null) {
if (!fSchemaElementDefault || fDefaultValue == null) {
fDocumentHandler.emptyElement(element, attributes, modifiedAugs);
} else {
fDocumentHandler.startElement(element, attributes, modifiedAugs);
fDocumentHandler.characters(fDefaultValue, null);
fDocumentHandler.endElement(element, modifiedAugs);
}
}
}
示例5: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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);
}
}
}
示例6: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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 {
if (!resolveXPointer(element, attributes, augs,
XPointerPart.EVENT_ELEMENT_START)) {
// xml:base and xml:lang processing
if (fFixupBase) {
processXMLBaseAttributes(attributes);
}
if (fFixupLang) {
processXMLLangAttributes(attributes);
}
// set the context invalid if the element till an element from the result infoset is included
fNamespaceContext.setContextInvalid();
return;
}
super.startElement(element, attributes, augs);
}
示例7: emptyElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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);
}
示例8: processXMLBaseAttributes
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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
}
}
}
示例9: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* Binds the namespaces. This method will handle calling the
* document handler to start the prefix mappings.
* <p>
* <strong>Note:</strong> This method makes use of the
* fAttributeQName variable. Any contents of the variable will
* be destroyed. Caller should copy the values out of this
* temporary variable before calling this method.
*
* @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 {
if (fDocumentHandler == null)
return;
checkForChildren();
_elementState.push(new ElementState(true));
sendIndentedElement("element");
sendElementEvent("namespaceName", element.uri);
sendElementEvent("localName", element.localpart);
sendElementEvent("prefix", element.prefix);
processAttributes(attributes);
processInScopeNamespaces();
sendElementEvent("baseURI", fDocumentLocation.getBaseSystemId());
if (fPSVInfoset) {
processPSVIStartElement(augs);
}
}
示例10: emptyElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
* 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 (fDocumentHandler == null)
return;
checkForChildren();
sendIndentedElement("element");
sendElementEvent("namespaceName", element.uri);
sendElementEvent("localName", element.localpart);
sendElementEvent("prefix", element.prefix);
processAttributes(attributes);
processInScopeNamespaces();
sendElementEvent("baseURI", fDocumentLocation.getBaseSystemId());
if (fPSVInfoset) {
processPSVIStartElement(augs);
}
sendEmptyElementEvent("children");
if (fPSVInfoset) {
processPSVIEndElement(augs);
}
sendUnIndentedElement("element");
}
示例11: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs, Augmentations augs)
throws XNIException {
fElements++;
fTagCharacters++; // open angle bracket
fTagCharacters += element.rawname.length();
if (attrs != null) {
int attrCount = attrs.getLength();
fAttributes += attrCount;
for (int i = 0; i < attrCount; i++) {
fTagCharacters++; // space
fTagCharacters += attrs.getQName(i).length();
fTagCharacters++; // '='
fTagCharacters++; // open quote
fOtherCharacters += attrs.getValue(i).length();
fTagCharacters++; // close quote
}
}
fTagCharacters++; // close angle bracket
}
示例12: emptyElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Empty element. */
public void emptyElement(QName element, XMLAttributes attrs, Augmentations augs)
throws XNIException {
fElements++;
fTagCharacters++; // open angle bracket
fTagCharacters += element.rawname.length();
if (attrs != null) {
int attrCount = attrs.getLength();
fAttributes += attrCount;
for (int i = 0; i < attrCount; i++) {
fTagCharacters++; // space
fTagCharacters += attrs.getQName(i).length();
fTagCharacters++; // '='
fTagCharacters++; // open quote
fOtherCharacters += attrs.getValue(i).length();
fTagCharacters++; // close quote
}
}
fTagCharacters++; // forward slash
fTagCharacters++; // close angle bracket
}
示例13: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs, Augmentations augs)
throws XNIException {
fSeenRootElement = true;
fElementDepth++;
fOut.print('<');
fOut.print(element.rawname);
if (attrs != null) {
/***
attrs = sortAttributes(attrs);
/***/
int len = attrs.getLength();
for (int i = 0; i < len; i++) {
fOut.print(' ');
fOut.print(attrs.getQName(i));
fOut.print("=\"");
normalizeAndPrint(attrs.getValue(i));
fOut.print('"');
}
}
fOut.print('>');
fOut.flush();
}
示例14: emptyElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Empty element. */
public void emptyElement(QName element, XMLAttributes attrs, Augmentations augs)
throws XNIException {
fSeenRootElement = true;
fElementDepth++;
fOut.print('<');
fOut.print(element.rawname);
if (attrs != null) {
/***
attrs = sortAttributes(attrs);
/***/
int len = attrs.getLength();
for (int i = 0; i < len; i++) {
fOut.print(' ');
fOut.print(attrs.getQName(i));
fOut.print("=\"");
normalizeAndPrint(attrs.getValue(i));
fOut.print('"');
}
}
fOut.print("/>");
fOut.flush();
}
示例15: startElement
import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
printInScopeNamespaces();
printIndent();
fOut.print("startElement(");
printElement(element, attributes);
if (augs != null) {
fOut.print(',');
printAugmentations(augs);
}
fOut.println(')');
fOut.flush();
fIndent++;
}