本文整理汇总了Java中org.apache.xerces.xni.XMLAttributes.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributes.getValue方法的具体用法?Java XMLAttributes.getValue怎么用?Java XMLAttributes.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xni.XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes.getValue方法的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: 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
}
}
}
示例3: parseAttributes
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
private void parseAttributes(XMLAttributes attrs, Stack<String> langStack, Stack<String> xmlBaseStack) {
if (attrs.getLength() > 0) attributeList = new ReaderAttributeList();
String u, n, v;
for (int i = 0; i < attrs.getLength(); i++) {
u = attrs.getURI(i);
n = attrs.getQName(i);
v = attrs.getValue(i);
if (isNamespace(n)) {
if (namespaces == null) namespaces = new HashMap<String, String>();
namespaces.put(n, v);
} else {
if (lang == null) lang = resolveLang(n, v, langStack);
if (xmlBase == null) xmlBase = resolveXmlBase(n, v, xmlBaseStack);
}
attributeList.add(u, n, v);
attributeStrings.add(n + "=\"" + v + "\"");
}
}
示例4: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* Invoked for a start element. If the element is a <script>, overrides the normal behavior to begin collecting
* the script text.
*/
public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException {
if (!isSupportedScript( element, attrs )) {
super.startElement( element, attrs, augs );
} else {
_activeScriptBlock = new StringBuffer();
_scriptLanguage = getScriptLanguage( attrs );
String srcAttribute = attrs.getValue( "src" );
if (srcAttribute != null) _activeScriptBlock.append( _scriptHandler.getIncludedScript( srcAttribute ) );
}
}
示例5: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* Invoked for a start element. If the element is a <script>, overrides the normal behavior to begin collecting
* the script text.
*/
public void startElement( QName element, XMLAttributes attrs, Augmentations augs ) throws XNIException {
if (!isSupportedScript( element, attrs )) {
super.startElement( element, attrs, augs );
} else {
_activeScriptBlock = new StringBuffer();
_scriptLanguage = getScriptLanguage( attrs );
String srcAttribute = attrs.getValue( "src" );
if (srcAttribute != null) _activeScriptBlock.append( _domParser.getIncludedScript( srcAttribute ) );
}
}
示例6: startAnnotationElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
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(">");
}
示例7: getDTDDeterminedID
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* 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;
}
示例8: processXMLLangAttributes
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/**
* Search for a xml:lang attribute, and if one is found, put the new
* [language] into effect.
*/
protected void processXMLLangAttributes(XMLAttributes attributes) {
String language = attributes.getValue(NamespaceContext.XML_URI, "lang");
if (language != null) {
fCurrentLanguage = language;
saveLanguage(fCurrentLanguage);
}
}
示例9: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
@Override
public void startElement(QName name, XMLAttributes attr, Augmentations aug) throws XNIException {
if (name.rawname.equals(TR)) {
tr++;
} else if (name.rawname.equals(TD)) {
td = true;
String id = attr.getValue("id");
if (id != null && id.startsWith("job")) {
}
} else {
td = false;
}
}
示例10: getValue
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Returns the value of the specified attribute, ignoring case. */
protected static String getValue(XMLAttributes attrs, String aname) {
int length = attrs != null ? attrs.getLength() : 0;
for (int i = 0; i < length; i++) {
if (attrs.getQName(i).equalsIgnoreCase(aname)) {
return attrs.getValue(i);
}
}
return null;
}
示例11: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs,
Augmentations augs) throws XNIException {
Element elementNode = fDocument.createElement(element.rawname);
int count = attrs != null ? attrs.getLength() : 0;
for (int i = 0; i < count; i++) {
String aname = attrs.getQName(i);
String avalue = attrs.getValue(i);
if (XMLChar.isValidName(aname)) {
elementNode.setAttribute(aname, avalue);
}
}
fCurrentNode.appendChild(elementNode);
fCurrentNode = elementNode;
}
示例12: startElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
@Override
public void startElement(QName elem, XMLAttributes attrs, Augmentations augs)
throws XNIException {
// Normalize the case of forced-elements to lowercase for backward compatability
if (!fSeenRootElement && elem.rawname.equalsIgnoreCase("html")) {
elem.localpart = "html";
elem.rawname = "html";
} else if (!fSeenHeadElement && elem.rawname.equalsIgnoreCase("head")) {
elem.localpart = "head";
elem.rawname = "head";
} else if (!fSeenBodyElement && elem.rawname.equalsIgnoreCase("body")) {
elem.localpart = "body";
elem.rawname = "body";
}
// Convert script tags of an OSML type to OSTemplate/OSData tags
if ("script".equalsIgnoreCase(elem.rawname)) {
String value = attrs.getValue("type");
String osmlTagName = SCRIPT_TYPE_TO_OSML_TAG.get(value);
if (osmlTagName != null) {
if (currentOsmlTag != null) {
throw new XNIException("Nested OpenSocial script elements");
}
currentOsmlTag = new QName(null, osmlTagName, osmlTagName, null);
if (scriptContent == null) {
scriptContent = new StringBuilder();
}
// Remove the type attribute
attrs.removeAttributeAt(attrs.getIndex("type"));
super.startElement(currentOsmlTag, attrs, augs);
return;
}
}
super.startElement(elem, attrs, augs);
}
示例13: getScriptLanguage
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
private String getScriptLanguage( XMLAttributes attrs ) {
return attrs == null ? null : attrs.getValue( "language" );
}
示例14: startAnnotation
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
void startAnnotation(String elemRawName, XMLAttributes attributes,
NamespaceContext namespaceContext) {
if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
fAnnotationBuffer.append("<").append(elemRawName).append(" ");
// attributes are a bit of a pain. To get this right, we have to keep track
// of the namespaces we've seen declared, then examine the namespace context
// for other namespaces so that we can also include them.
// optimized for simplicity and the case that not many
// namespaces are declared on this annotation...
ArrayList namespaces = new ArrayList();
for (int i = 0; i < attributes.getLength(); ++i) {
String aValue = attributes.getValue(i);
String aPrefix = attributes.getPrefix(i);
String aQName = attributes.getQName(i);
// if it's xmlns:* or xmlns, must be a namespace decl
if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
}
fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
}
// now we have to look through currently in-scope namespaces to see what
// wasn't declared here
Enumeration currPrefixes = namespaceContext.getAllPrefixes();
while(currPrefixes.hasMoreElements()) {
String prefix = (String)currPrefixes.nextElement();
String uri = namespaceContext.getURI(prefix);
if (uri == null) {
uri = XMLSymbols.EMPTY_STRING;
}
if (!namespaces.contains(prefix)) {
// have to declare this one
if(prefix == XMLSymbols.EMPTY_STRING) {
fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
}
else {
fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
}
}
}
fAnnotationBuffer.append(">\n");
}
示例15: printElement
import org.apache.xerces.xni.XMLAttributes; //导入方法依赖的package包/类
/** Prints an element. */
protected void printElement(QName element, XMLAttributes attributes) {
fOut.print("element=");
fOut.print('{');
fOut.print("prefix=");
printQuotedString(element.prefix);
fOut.print(',');
fOut.print("localpart=");
printQuotedString(element.localpart);
fOut.print(',');
fOut.print("rawname=");
printQuotedString(element.rawname);
fOut.print(',');
fOut.print("uri=");
printQuotedString(element.uri);
fOut.print('}');
fOut.print(',');
fOut.print("attributes=");
if (attributes == null) {
fOut.println("null");
}
else {
fOut.print('{');
int length = attributes.getLength();
for (int i = 0; i < length; i++) {
if (i > 0) {
fOut.print(',');
}
attributes.getName(i, fQName);
String attrType = attributes.getType(i);
String attrValue = attributes.getValue(i);
String attrNonNormalizedValue = attributes.getNonNormalizedValue(i);
Augmentations augs = attributes.getAugmentations(i);
fOut.print("name=");
fOut.print('{');
fOut.print("prefix=");
printQuotedString(fQName.prefix);
fOut.print(',');
fOut.print("localpart=");
printQuotedString(fQName.localpart);
fOut.print(',');
fOut.print("rawname=");
printQuotedString(fQName.rawname);
fOut.print(',');
fOut.print("uri=");
printQuotedString(fQName.uri);
fOut.print('}');
fOut.print(',');
fOut.print("type=");
printQuotedString(attrType);
fOut.print(',');
fOut.print("value=");
printQuotedString(attrValue);
fOut.print(',');
fOut.print("nonNormalizedValue=");
printQuotedString(attrNonNormalizedValue);
if (attributes.isSpecified(i) == false ) {
fOut.print("(default)");
}
if (augs != null) {
fOut.print(',');
printAugmentations(augs);
}
fOut.print('}');
}
fOut.print('}');
}
}