当前位置: 首页>>代码示例>>Java>>正文


Java XMLAttributesImpl类代码示例

本文整理汇总了Java中org.apache.xerces.util.XMLAttributesImpl的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributesImpl类的具体用法?Java XMLAttributesImpl怎么用?Java XMLAttributesImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLAttributesImpl类属于org.apache.xerces.util包,在下文中一共展示了XMLAttributesImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Info

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的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;
        }
    }
}
 
开发者ID:carson0321,项目名称:node-boilerpipe,代码行数:33,代码来源:HTMLTagBalancer.java

示例2: buildStartElementXmlStr

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private String buildStartElementXmlStr(QName qname, XMLAttributesImpl attributes) {
	
	boolean format = attributes.getLength() > 3;
	
	StringBuilder builder = new StringBuilder();
	builder.append("<").append(qname.rawname);
	for (int i = 0; i < attributes.getLength(); i++) {
		if (format) {
			builder.append("\n\t");
		}
		builder.append(' ').append(attributes.getName(i)).append('=').append('\"').append(attributes.getValue(i))
				.append('\"');
	}
	builder.append('>');
	return builder.toString();
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:17,代码来源:CorrectWriter.java

示例3: tryToFindAttrs

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void tryToFindAttrs(XMLAttributesImpl attributes, XMLStringBuffer buf) throws IOException {
	TmxEntityScanner scanner = new TmxEntityScanner(buf);
	while (!scanner.hasFinish()) {
		scanner.skipSpaces();
		// attribute name
		scanner.scanQName(fAttributeQName);
		// equals
		scanner.skipSpaces();
		if (!scanner.skipChar('=')) {
			error("not found '='");
			return;
		}
		int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);
		boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, fAttributeQName.rawname,
				fIsEntityDeclaredVC, null, scanner);
		attributes.setValue(attrIndex, fTempString.toString());
		if (!isSameNormalizedAttr) {
			attributes.setNonNormalizedValue(attrIndex, fTempString2.toString());
		}
		attributes.setSpecified(attrIndex, true);
	}
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:23,代码来源:TmxScanner.java

示例4: appendErrorCode

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void appendErrorCode() throws IOException {
	QName qName = fCurrentElement;
	XMLAttributesImpl attr = fAttributes;

	StringBuilder builder = new StringBuilder();
	builder.append('<').append(qName.rawname);
	for (int i = 0; i < attr.getLength(); i++) {
		builder.append(' ').append(attr.getQName(i)).append('=').append('\"').append(attr.getValue(i)).append('\"');
	}
	builder.append('>');

	errorCode.append(builder.toString());

	// for debug
	if (debug) {
		System.out.println("error code: start elem:" + builder.toString());
	}
	// end debug
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:20,代码来源:TmxScanner.java

示例5: createAttributes

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private XMLAttributes createAttributes(Vector atts) {
    XMLAttributes attributes = new XMLAttributesImpl();
    if (atts != null) {
        for (int i = 0; i < atts.size(); i += 3) {
            String rawname = (String)atts.elementAt(i);
            String value = (String)atts.elementAt(i + 1);
            String type = (String)atts.elementAt(i + 2);
            attributes.addAttribute(createQName(rawname), type, value);
        }
    }
    return attributes;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:13,代码来源:PSVIWriter.java

示例6: scanAttribute

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void scanAttribute(XMLAttributesImpl attributes) throws RepairableException, IOException,
		TmxEndEntityException {

	entityScanner.scanQName(attributeQName);

	entityScanner.skipSpaces();
	if (!entityScanner.skipChar('=')) {
		throw new RepairableException("[attribute]miss '='.");
	}
	entityScanner.skipSpaces();

	// content
	int oldLen = attributes.getLength();
	int attrIndex = attributes.addAttribute(attributeQName, XMLSymbols.fCDATASymbol, null);

	if (oldLen == attributes.getLength()) {
		newRepairableException("[attribute]multiplay attribute-key.");
	}

	// Scan attribute value and return true if the un-normalized and normalized value are the same
	boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, attributeQName.rawname,
			fIsEntityDeclaredVC, fCurrentElement.rawname, null);

	attributes.setValue(attrIndex, fTempString.toString());

	// If the non-normalized and normalized value are the same, avoid creating a new string.
	if (!isSameNormalizedAttr) {
		attributes.setNonNormalizedValue(attrIndex, fTempString2.toString());
	}
	attributes.setSpecified(attrIndex, true);
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:32,代码来源:TmxScanner2.java

示例7: scanAttribute

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void scanAttribute(XMLAttributesImpl attributes) throws IOException {

		// attribute name
		entityScanner.scanQName(fAttributeQName);

		// equals
		entityScanner.skipSpaces();
		if (!entityScanner.skipChar('=')) {
			error("not found '='");
		}
		entityScanner.skipSpaces();

		// content
		int oldLen = attributes.getLength();
		int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);

		if (oldLen == attributes.getLength()) {
			error("Multiple attr");
		}

		// Scan attribute value and return true if the un-normalized and normalized value are the same
		boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, fAttributeQName.rawname,
				fIsEntityDeclaredVC, fCurrentElement.rawname, null);

		attributes.setValue(attrIndex, fTempString.toString());
		// If the non-normalized and normalized value are the same, avoid creating a new string.
		if (!isSameNormalizedAttr) {
			attributes.setNonNormalizedValue(attrIndex, fTempString2.toString());
		}
		attributes.setSpecified(attrIndex, true);
	}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:32,代码来源:TmxScanner.java

示例8: processDOMElement

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void processDOMElement(
    Node node,
    String elementName,
    String tagName) {
    if (node == null)
        return;
    boolean foundElem = false;
    for (Element child = DOMUtil.getFirstChildElement(node);
        child != null;
        child = DOMUtil.getNextSiblingElement(child)) {
        if (DOMUtil.getLocalName(child).equals(elementName)) {
            if (!foundElem) {
                sendIndentedElement(tagName);
                foundElem = true;
            }
            sendIndentedElement("element");
            sendElementEvent(
                "namespaceName",
                DOMUtil.getNamespaceURI(child));
            sendElementEvent("localName", DOMUtil.getLocalName(child));
            sendElementEvent("prefix", child.getPrefix());
            sendIndentedElement("children");
            sendIndentedElement("character");
            sendElementEvent("textContent", DOMUtil.getChildText(child));
            sendUnIndentedElement("character");
            sendUnIndentedElement("children");

            //Create XMLAttributes from DOM
            Attr[] atts = (Element) child == null ? null : DOMUtil.getAttrs((Element) child);
            XMLAttributes attrs = new XMLAttributesImpl();
            for (int i=0; i<atts.length; i++) {
                Attr att = (Attr)atts[i];
                attrs.addAttribute(
                        new QName(att.getPrefix(), att.getLocalName(), att.getName(), att.getNamespaceURI()),
                        "CDATA" ,att.getValue()
                        );
            }

            processAttributes(attrs);
            sendUnIndentedElement("element");
        }
    }
    if (foundElem) {
        sendUnIndentedElement(tagName);
    }
    else {
        sendEmptyElementEvent(tagName);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:50,代码来源:PSVIWriter.java

示例9: appendStartElem

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
private void appendStartElem(QName qName, XMLAttributesImpl attr) throws IOException {

		if (!errorCode.isEmpty()) {
			new ErrorDescription(errorCode.lineNumber, errorCode.columnNumber, errorCode.getDescription());
			errorCode.clear();
		}
		// set default
		if (qName == null) {
			qName = fCurrentElement;
		}
		if (attr == null) {
			attr = fAttributes;
		}

		writer.write('<');
		writer.write(qName.rawname);
		for (int i = 0; i < attr.getLength(); i++) {
			writer.write(' ');
			writer.write(attr.getQName(i));
			writer.write('=');
			writer.write('\"');
			writer.write(attr.getValue(i));
			writer.write('\"');
		}
		writer.write('>');

		// for debug
		if (debug) {
			StringBuffer buf = new StringBuffer();
			buf.append('<');
			buf.append(qName.rawname);
			for (int i = 0; i < attr.getLength(); i++) {
				buf.append(' ');
				buf.append(attr.getQName(i));
				buf.append('=');
				buf.append('\"');
				buf.append(attr.getValue(i));
				buf.append('\"');
			}
			buf.append('>');
			System.out.println("w====w:write start elem:" + buf.toString());
		}
		writer.flush();
		// end debug
	}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:46,代码来源:TmxScanner.java

示例10: scanAttribute

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
/** 
 * Scans a real attribute. 
 *
 * @param attributes The list of attributes.
 * @param empty      Is used for a second return value to indicate 
 *                   whether the start element tag is empty 
 *                   (e.g. "/&gt;").
 */
protected boolean scanAttribute(XMLAttributesImpl attributes,
                                boolean[] empty)
    throws IOException {
    return scanAttribute(attributes,empty,'/');
}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:14,代码来源:HTMLScanner.java

示例11: scanPseudoAttribute

import org.apache.xerces.util.XMLAttributesImpl; //导入依赖的package包/类
/** 
 * Scans a pseudo attribute. 
 *
 * @param attributes The list of attributes.
 */
protected boolean scanPseudoAttribute(XMLAttributesImpl attributes)
    throws IOException {
    return scanAttribute(attributes,fSingleBoolean,'?');
}
 
开发者ID:ecologylab,项目名称:BigSemanticsJava,代码行数:10,代码来源:HTMLScanner.java


注:本文中的org.apache.xerces.util.XMLAttributesImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。