• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLAttributesImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSLFPowerPointExtractor类代码示例发布时间:2022-05-22
下一篇:
Java ClassLoaderData类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap