本文整理汇总了Java中org.xml.sax.Attributes.getURI方法的典型用法代码示例。如果您正苦于以下问题:Java Attributes.getURI方法的具体用法?Java Attributes.getURI怎么用?Java Attributes.getURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.Attributes
的用法示例。
在下文中一共展示了Attributes.getURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Copy an entire Attributes object.
*
* @param atts The attributes to copy.
*/
public void setAttributes(Attributes atts) {
_length = atts.getLength();
if (_length > 0) {
if (_length >= _algorithmData.length) {
resizeNoCopy();
}
int index = 0;
for (int i = 0; i < _length; i++) {
_data[index++] = atts.getURI(i);
_data[index++] = atts.getLocalName(i);
_data[index++] = atts.getQName(i);
_data[index++] = atts.getType(i);
_data[index++] = atts.getValue(i);
index++;
_toIndex[i] = false;
_alphabets[i] = null;
}
}
}
示例2: startElement
import org.xml.sax.Attributes; //导入方法依赖的package包/类
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) {
flushText();
if (builder != null) {
builderStack.push(builder);
}
Location loc = makeLocation();
builder = schemaBuilder.makeElementAnnotationBuilder(namespaceURI,
localName,
findPrefix(qName, namespaceURI),
loc,
getComments(),
getContext());
int len = atts.getLength();
for (int i = 0; i < len; i++) {
String uri = atts.getURI(i);
builder.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
atts.getValue(i), loc);
}
}
示例3: startElement
import org.xml.sax.Attributes; //导入方法依赖的package包/类
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
TypedXmlWriter txw = stack.peek()._element(uri, localName, TypedXmlWriter.class);
stack.push(txw);
if (atts != null) {
for(int i = 0; i < atts.getLength(); i++) {
String auri = atts.getURI(i);
if ("http://www.w3.org/2000/xmlns/".equals(auri)) {
if ("xmlns".equals(atts.getLocalName(i)))
txw._namespace(atts.getValue(i), "");
else
txw._namespace(atts.getValue(i),atts.getLocalName(i));
} else {
if ("schemaLocation".equals(atts.getLocalName(i))
&& "".equals(atts.getValue(i)))
continue;
txw._attribute(auri, atts.getLocalName(i), atts.getValue(i));
}
}
}
}
示例4: addAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Add the given attributes to the currently collected ones. These
* attributes are always added, regardless of whether on not an element
* is currently open.
* @param atts List of attributes to add to this list
*/
public void addAttributes(Attributes atts) throws SAXException {
int nAtts = atts.getLength();
for (int i = 0; i < nAtts; i++) {
String uri = atts.getURI(i);
if (null == uri)
uri = "";
addAttributeAlways(
uri,
atts.getLocalName(i),
atts.getQName(i),
atts.getType(i),
atts.getValue(i),
false);
}
}
示例5: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Copy an entire Attributes object.
*
* <p>It may be more efficient to reuse an existing object
* rather than constantly allocating new ones.</p>
*
* @param atts The attributes to copy.
*/
public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
if (length > 0) {
data = new String[length*5];
for (int i = 0; i < length; i++) {
data[i*5] = atts.getURI(i);
data[i*5+1] = atts.getLocalName(i);
data[i*5+2] = atts.getQName(i);
data[i*5+3] = atts.getType(i);
data[i*5+4] = atts.getValue(i);
}
}
}
示例6: addAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Add the contents of the attribute list to this list.
*
* @param atts List of attributes to add to this list
*/
public void addAttributes(Attributes atts)
{
int nAtts = atts.getLength();
for (int i = 0; i < nAtts; i++)
{
String uri = atts.getURI(i);
if (null == uri)
uri = "";
String localName = atts.getLocalName(i);
String qname = atts.getQName(i);
int index = this.getIndex(uri, localName);
// System.out.println("MutableAttrListImpl#addAttributes: "+uri+":"+localName+", "+index+", "+atts.getQName(i)+", "+this);
if (index >= 0)
this.setAttribute(index, uri, localName, qname, atts.getType(i),
atts.getValue(i));
else
addAttribute(uri, localName, qname, atts.getType(i),
atts.getValue(i));
}
}
示例7: addAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Add the given attributes to the currently collected ones. These
* attributes are always added, regardless of whether on not an element
* is currently open.
* @param atts List of attributes to add to this list
*/
public void addAttributes(Attributes atts) throws SAXException
{
int nAtts = atts.getLength();
for (int i = 0; i < nAtts; i++)
{
String uri = atts.getURI(i);
if (null == uri)
uri = "";
addAttributeAlways(
uri,
atts.getLocalName(i),
atts.getQName(i),
atts.getType(i),
atts.getValue(i),
false);
}
}
示例8: push
import org.xml.sax.Attributes; //导入方法依赖的package包/类
private void push(Element e) throws SAXException {
String name = e.name();
String localName = e.localName();
String namespace = e.namespace();
String prefix = prefixOf(name);
// System.err.println("%% Pushing " + name);
e.clean();
if (!namespaces) namespace = localName = "";
if (virginStack && localName.equalsIgnoreCase(theDoctypeName)) {
try {
theEntityResolver.resolveEntity(theDoctypePublicId, theDoctypeSystemId);
} catch (IOException ew) { } // Can't be thrown for root I believe.
}
if (foreign(prefix, namespace)) {
theContentHandler.startPrefixMapping(prefix, namespace);
// System.err.println("%% Mapping [" + prefix + "] for elements to " + namespace);
}
Attributes atts = e.atts();
int len = atts.getLength();
for (int i = 0; i < len; i++) {
String attNamespace = atts.getURI(i);
String attPrefix = prefixOf(atts.getQName(i));
if (foreign(attPrefix, attNamespace)) {
theContentHandler.startPrefixMapping(attPrefix, attNamespace);
// System.err.println("%% Mapping [" + attPrefix + "] for attributes to " + attNamespace);
}
}
theContentHandler.startElement(namespace, localName, name, e.atts());
e.setNext(theStack);
theStack = e;
virginStack = false;
if (CDATAElements && (theStack.flags() & Schema.F_CDATA) != 0) {
theScanner.startCDATA();
}
}
示例9: setAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Copy an entire Attributes object.
*
* <p>It may be more efficient to reuse an existing object
* rather than constantly allocating new ones.</p>
*
* @param atts The attributes to copy.
*/
public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
data = new String[length*5];
for (int i = 0; i < length; i++) {
data[i*5] = atts.getURI(i);
data[i*5+1] = atts.getLocalName(i);
data[i*5+2] = atts.getQName(i);
data[i*5+3] = atts.getType(i);
data[i*5+4] = atts.getValue(i);
}
}
示例10: attributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
void attributes(Attributes atts) throws SAXException {
int len = atts.getLength();
for (int i = 0; i < len; i++) {
String uri = atts.getURI(i);
if (uri.length() == 0) {
String name = atts.getLocalName(i);
if (name.equals("name")) {
setName(atts.getValue(i).trim());
} else if (name.equals("ns")) {
ns = atts.getValue(i);
} else if (name.equals("datatypeLibrary")) {
datatypeLibrary = atts.getValue(i);
checkUri(datatypeLibrary);
if (!datatypeLibrary.equals("")
&& !Uri.isAbsolute(datatypeLibrary)) {
error("relative_datatype_library");
}
if (Uri.hasFragmentId(datatypeLibrary)) {
error("fragment_identifier_datatype_library");
}
datatypeLibrary = Uri.escapeDisallowedChars(datatypeLibrary);
} else {
setOtherAttribute(name, atts.getValue(i));
}
} else if (uri.equals(relaxngURI)) {
error("qualified_attribute", atts.getLocalName(i));
} else if (uri.equals(WellKnownNamespaces.XML)
&& atts.getLocalName(i).equals("base")) {
xmlBaseHandler.xmlBaseAttribute(atts.getValue(i));
} else {
if (annotations == null) {
annotations = schemaBuilder.makeAnnotations(null, getContext());
}
annotations.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
atts.getValue(i), startLocation);
}
}
endAttributes();
}
示例11: countAttributes
import org.xml.sax.Attributes; //导入方法依赖的package包/类
protected final int countAttributes(Attributes atts) {
// Count attributes ignoring any in the XMLNS namespace
// Note, such attributes may be produced when transforming from a DOM node
int count = 0;
for (int i = 0; i < atts.getLength(); i++) {
final String uri = atts.getURI(i);
if (uri == "http://www.w3.org/2000/xmlns/" || uri.equals("http://www.w3.org/2000/xmlns/")) {
continue;
}
count++;
}
return count;
}
示例12: handleClassTag
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
"# {0} - tag name",
"ERR_tagNotJavaIdentifier=Invalid class name: {0}",
"# {0} - tag name",
"ERR_fxControllerPermittedOnRoot=fx:controller is not permitted on tag {0}. Can be only present on root element."
})
private FxNewInstance handleClassTag(String localName, Attributes atts) {
String fxValueContent = null;
String fxFactoryContent = null;
String fxId = null;
boolean constant = false;
int off = contentLocator.getElementOffset() + 1; // the <
for (int i = 0; i < atts.getLength(); i++) {
String uri = atts.getURI(i);
if (!isFxmlNamespaceUri(uri)) {
// no special attribute
continue;
}
String name = atts.getLocalName(i);
if (FX_VALUE.equals(name)) {
fxValueContent = atts.getValue(i);
} else if (FX_ATTR_CONSTANT.equals(name)) {
fxValueContent = atts.getValue(i);
constant = true;
} else if (FX_FACTORY.equals(name)) {
fxFactoryContent = atts.getValue(i);
} else if (FX_ID.equals(name)) {
fxId = atts.getValue(i);
} else if (FX_CONTROLLER.equals(name)) {
if (nodeStack.peek().getKind() != Kind.Source) {
addAttributeError(atts.getQName(i),
"fx-controller-permitted-on-root",
ERR_fxControllerPermittedOnRoot(localName),
localName
);
} else {
controllerName = atts.getValue(i);
}
} else {
addAttributeError(
atts.getQName(i),
"invalid-property-reserved-name",
ERR_invalidReservedPropertyName(name),
name
);
}
}
// first we must check how this class tag is created.
FxNewInstance instance = accessor.createInstance(localName, fxValueContent, constant, fxFactoryContent, fxId);
if (!FxXmlSymbols.isQualifiedIdentifier(localName)) {
// not a java identifier, error
addError(
new ErrorMark(
off, localName.length(),
"invalid-class-name",
ERR_tagNotJavaIdentifier(localName),
localName
));
accessor.makeBroken(instance);
return instance;
}
return instance;
}
示例13: handleFxReference
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
"# {0} - attribute local name",
"ERR_unexpectedReferenceAttribute=Unexpected attribute in fx:reference or fx:copy: {0}",
"ERR_missingReferenceSource=Missing 'source' attribute in fx:reference or fx:copy"
})
private FxNode handleFxReference(Attributes atts, boolean copy) {
String refId = null;
String id = null;
for (int i = 0; i < atts.getLength(); i++) {
String ns = atts.getURI(i);
String name = atts.getLocalName(i);
if (!isFxmlNamespaceUri(ns)) {
if (FX_ATTR_REFERENCE_SOURCE.equals(name) && refId == null) {
refId = atts.getValue(i);
} else if (!copy) {
// error, references do not support normal attributes
addAttributeError(atts.getQName(i),
"invalid-reference-attribute",
ERR_unexpectedReferenceAttribute(name),
name
);
}
} else {
if (FX_ID.equals(name) && id == null) {
id = atts.getValue(i);
} else {
// error, unexpected attribute
addAttributeError(atts.getQName(i),
"invalid-reference-attribute",
ERR_unexpectedReferenceAttribute(name),
name
);
}
}
}
FxObjectBase ref = accessor.createCopyReference(copy, refId);
if (refId == null || "".equals(refId)) {
// error, no source attribute found
addError(
"missing-reference-source",
ERR_missingReferenceSource()
);
accessor.makeBroken(ref);
}
return ref;
}
示例14: handlePropertyTag
import org.xml.sax.Attributes; //导入方法依赖的package包/类
@NbBundle.Messages({
"# {0} - tag name",
"ERR_invalidPropertyName=Invalid property name: {0}"
})
private FxNode handlePropertyTag(String propName, Attributes atts) {
PropertyValue pv;
int errorAttrs = 0;
for (int i = 0; i < atts.getLength(); i++) {
String uri = atts.getURI(i);
if (uri != null) {
String qn = atts.getQName(i);
errorAttrs++;
addAttributeError(qn,
"property-namespaced-attribute",
ERR_propertyElementNamespacedAttribute(qn),
qn
);
}
}
int stProp = FxXmlSymbols.findStaticProperty(propName);
switch (stProp) {
case -1:
// simple property
if (!Utilities.isJavaIdentifier(propName)) {
addError(new ErrorMark(
start, end,
"invalid-property-name",
ERR_invalidPropertyName(propName),
propName
));
}
if (errorAttrs == atts.getLength()) {
pv = handleSimpleProperty(propName, atts);
} else {
pv = handleMapProperty(propName, atts);
}
break;
case -2:
// broken name, but must create a node
pv = accessor.makeBroken(accessor.createProperty(propName, false));
// do not add the property to the parent, it's broken beyond repair
addError(new ErrorMark(
start, end,
"invalid-property-name",
ERR_invalidPropertyName(propName),
propName
));
break;
default:
// static property, just ignore for now
pv = handleStaticProperty(propName.substring(0, stProp),
propName.substring(stProp + 1), atts);
break;
}
return pv;
}
示例15: handleFxInclude
import org.xml.sax.Attributes; //导入方法依赖的package包/类
/**
* Processes ?include directive
*
* @param include
*/
@NbBundle.Messages({
"ERR_missingIncludeName=Missing include name",
"# {0} - attribute name",
"ERR_unexpectedIncludeAttribute=Unexpected attribute in fx:include: {0}"
})
private FxNode handleFxInclude(Attributes atts, String localName) {
String include = null;
String id = null;
for (int i = 0; i < atts.getLength(); i++) {
String uri = atts.getURI(i);
String attName = atts.getLocalName(i);
if (FX_ATTR_REFERENCE_SOURCE.equals(attName)) {
include = atts.getValue(i);
continue;
}
if (isFxmlNamespaceUri(uri)) {
if (FX_ID.equals(attName)) {
id = atts.getValue(i);
} else {
String qName = atts.getQName(i);
addAttributeError(
qName,
"unexpected-include-attribute",
ERR_unexpectedIncludeAttribute(qName),
qName
);
}
}
}
if (include == null) {
// must be some text, otherwise = error
addAttributeError(
ContentLocator.ATTRIBUTE_TARGET,
"missing-included-name",
ERR_missingIncludeName()
);
FxNode n = accessor.createErrorElement(localName);
initElement(n);
addError("invalid-fx-element", ERR_invalidFxElement(localName), localName);
return n;
}
// guide: fnames starting with slash are treated relative to the classpath
FxInclude fxInclude = accessor.createInclude(include, id);
return fxInclude;
}