XMLElement xml = new XMLElement();
FileReader reader = new FileReader("filename.xml");
xml.parseFromReader(reader);
XMLElement element = ...;
Enumeration enum = element.getAttributeNames();
while (enum.hasMoreElements()) {
String key = (String) enum.nextElement();
String value = element.getStringAttribute(key);
System.out.println(key + " = " + value);
}
<title>The Title</title>
@see XMLParseException @author Marc De Scheemaecker<cyberelf@mac.com>
XMLElement xml = new XMLElement();
FileReader reader = new FileReader("filename.xml");
xml.parseFromReader(reader);
XMLElement element = ...;
Enumeration enum = element.getAttributeNames();
while (enum.hasMoreElements()) {
String key = (String) enum.nextElement();
String value = element.getStringAttribute(key);
System.out.println(key + " = " + value);
}
<title>The Title</title>
@see com.adito.boot.XMLParseException @author Marc De Scheemaecker<cyberelf@mac.com>
The main function of this wrapper is to ensure that parsers can only read elements and attributes by 'consuming' them, which removes the given value. This allows for a natural hierarchy among parsers -- more specific parsers will run first, and if they consume a value, less-specific parsers will not see it.
Note that NanoXML is not 100% XML 1.0 compliant:
<!ENTITY...>
. <![CDATA[...]]>
You can opt to use a SAX compatible API, by including both nanoxml.jar
and nanoxml-sax.jar
in your classpath and setting the property org.xml.sax.parser
to nanoxml.sax.SAXParser
$Revision: 1.32 $
$Date: 2006/08/25 08:34:00 $
@see XMLParseException @author Marc De Scheemaecker<Marc.DeScheemaecker@advalvas.be> @version 1.5
Note that NanoXML is not 100% XML 1.0 compliant:
<!ENTITY...>
. You can opt to use a SAX compatible API, by including both nanoxml.jar
and nanoxml-sax.jar
in your classpath and setting the property org.xml.sax.parser
to nanoxml.sax.SAXParser
$Revision: 1.3 $
$Date: 2005/11/19 09:15:30 $
@author Marc De Scheemaecker <
XMLElement xml = new XMLElement();
FileReader reader = new FileReader("filename.xml");
xml.parseFromReader(reader);
XMLElement element = ...;
Enumeration enum = element.getAttributeNames();
while (enum.hasMoreElements()) {
String key = (String) enum.nextElement();
String value = element.getStringAttribute(key);
System.out.println(key + " = " + value);
}
<title>The Title</title>
@see nanoxml.XMLParseException @author Marc De Scheemaecker<cyberelf@mac.com> @version $Name: RELEASE_2_2_1 $, $Revision: 1.4 $
An interface describing the methods needed for simple interaction with XML data
Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
@version $Revision: 2.2 $
XMLElement xml = new XMLElement();
FileReader reader = new FileReader("filename.xml");
xml.parseFromReader(reader);
XMLElement element = ...; for (String key : element.getAttributeNames()) { String value = element.getStringAttribute(key); System.out.println(key + " = " + value); }
<title>The Title</title>
@see XMLParseException @author Marc De Scheemaecker<cyberelf@mac.com> @version $Name$, $Revision: 1950 $
The intent of this library (with regard to Processing) is to provide an extremely simple (and compact) means of reading and writing XML data from a sketch. As such, this is not a full-featured library for handling XML data. For those who need it, more sophisticated libraries are available, and there are no plans to add significant new features to this library. import processing.xml.*; XMLElement xml = new XMLElement("filename.xml", this); int childCount = xml.getChildCount(); for (int i = 0; i < childCount; i++) { XMLElement kid = xml.getChild(i); float attr = kid.getFloatAttribute("some-attribute"); println("some-attribute is " + attr); }
@author Marc De Scheemaecker<cyberelf@mac.com>
XMLElement
wraps around an {@link Element} and provides convenience methods.
@author Janni Kovacs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|