Thread: [Practicalxml-commits] SF.net SVN: practicalxml:[69] trunk/src (Page 2)
Brought to you by:
kdgregory
From: Auto-Generated S. C. M. <pra...@li...> - 2008-12-30 14:02:01
|
Revision: 69 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=69&view=rev Author: kdgregory Date: 2008-12-30 14:01:57 +0000 (Tue, 30 Dec 2008) Log Message: ----------- Rename DomUtil.toList() to asList() -- consistent with Arrays.asList() Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/DomUtil.java trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java Modified: trunk/src/main/java/net/sf/practicalxml/DomUtil.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2008-12-30 13:49:58 UTC (rev 68) +++ trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2008-12-30 14:01:57 UTC (rev 69) @@ -449,7 +449,7 @@ * @throws ClassCastException if any node in the list is not the expected * type. */ - public static <T> List<T> toList(NodeList nodelist, Class<T> ofClass) + public static <T> List<T> asList(NodeList nodelist, Class<T> ofClass) { int size = nodelist.getLength(); List<T> result = new ArrayList<T>(size); Modified: trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java =================================================================== --- trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2008-12-30 13:49:58 UTC (rev 68) +++ trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2008-12-30 14:01:57 UTC (rev 69) @@ -318,7 +318,7 @@ DomUtil.setText(root, "blah blah blah"); Element child2 = DomUtil.appendChild(root, "foo"); - List<Element> result = DomUtil.toList(root.getElementsByTagName("*"), Element.class); + List<Element> result = DomUtil.asList(root.getElementsByTagName("*"), Element.class); assertEquals(2, result.size()); assertSame(child1, result.get(0)); assertSame(child2, result.get(1)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2008-12-30 14:08:12
|
Revision: 70 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=70&view=rev Author: kdgregory Date: 2008-12-30 14:08:10 +0000 (Tue, 30 Dec 2008) Log Message: ----------- XPathWrapper: all forms of evaluate() now take a Node, for consistency with the rest of the world - refactor evaluation Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java Modified: trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java 2008-12-30 14:01:57 UTC (rev 69) +++ trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java 2008-12-30 14:08:10 UTC (rev 70) @@ -1,6 +1,5 @@ package net.sf.practicalxml.xpath; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -13,11 +12,10 @@ import javax.xml.xpath.XPathFunction; import javax.xml.xpath.XPathVariableResolver; -import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import net.sf.practicalxml.DomUtil; import net.sf.practicalxml.XmlException; @@ -142,7 +140,7 @@ * * @return The wrapper, so that calls may be chained. */ - public XPathWrapper bindFunction(AbstractFunction func) + public XPathWrapper bindFunction(AbstractFunction<?> func) { _functions.addFunction(func); return this; @@ -164,7 +162,7 @@ * * @return The wrapper, so that calls may be chained. */ - public XPathWrapper bindFunction(AbstractFunction func, String prefix) + public XPathWrapper bindFunction(AbstractFunction<?> func, String prefix) { _functions.addFunction(func); return bindNamespace(prefix, func.getNamespaceUri()); @@ -254,121 +252,44 @@ /** - * Applies this expression to the root of the specified document, - * converting the resulting NodeList into a java.util.List for ease - * in iteration. + * Applies this expression to the the specified node, converting the + * resulting <code>NodeList</code> into a <code>java.util.List</code>. */ - public List<Node> evaluate(Document context) + public List<Node> evaluate(Node context) { - return evaluate(context.getDocumentElement()); + return DomUtil.asList( + evaluate(context, XPathConstants.NODESET, NodeList.class), + Node.class); } /** - * Applies this expression to the specified element, converting the - * resulting NodeList into a java.util.List for ease in iteration. - */ - public List<Node> evaluate(Element context) - { - compileIfNeeded(); - try - { - NodeList result = (NodeList)_compiled.evaluate(context, XPathConstants.NODESET); - List<Node> ret = new ArrayList<Node>(result.getLength()); - for (int ii = 0 ; ii < result.getLength() ; ii++) - { - ret.add(result.item(ii)); - } - return ret; - } - catch (Exception ee) - { - throw new XmlException("unable to evaluate: " + _expr, ee); - } - } - - - /** - * Applies this expression to the root of the specified document, - * requesting the <code>STRING</code> return type. - */ - public String evaluateAsString(Document context) - { - return evaluateAsString(context.getDocumentElement()); - } - - - /** - * Applies this expression to the specified element, requesting the + * Applies this expression to the specified node, requesting the * <code>STRING</code> return type. */ - public String evaluateAsString(Element context) + public String evaluateAsString(Node context) { - compileIfNeeded(); - try - { - return _compiled.evaluate(context); - } - catch (Exception ee) - { - throw new XmlException("unable to evaluate: " + _expr, ee); - } + return evaluate(context, XPathConstants.STRING, String.class); } /** - * Applies this expression to the root of the specified document, - * requesting the <code>NUMBER</code> return type. - */ - public Double evaluateAsNumber(Document context) - { - return evaluateAsNumber(context.getDocumentElement()); - } - - - /** - * Applies this expression to the specified element, requesting the + * Applies this expression to the specified node, requesting the * <code>NUMBER</code> return type. */ - public Double evaluateAsNumber(Element context) + public Number evaluateAsNumber(Node context) { - compileIfNeeded(); - try - { - return (Double)_compiled.evaluate(context, XPathConstants.NUMBER); - } - catch (Exception ee) - { - throw new XmlException("unable to evaluate: " + _expr, ee); - } + return evaluate(context, XPathConstants.NUMBER, Number.class); } /** - * Applies this expression to the root of the specified document, - * requesting the <code>BOOLEAN</code> return type. - */ - public Boolean evaluateAsBoolean(Document context) - { - return evaluateAsBoolean(context.getDocumentElement()); - } - - - /** - * Applies this expression to the specified element, requesting the + * Applies this expression to the the specified node, requesting the * <code>BOOLEAN</code> return type. */ - public Boolean evaluateAsBoolean(Element context) + public Boolean evaluateAsBoolean(Node context) { - compileIfNeeded(); - try - { - return (Boolean)_compiled.evaluate(context, XPathConstants.BOOLEAN); - } - catch (Exception ee) - { - throw new XmlException("unable to evaluate: " + _expr, ee); - } + return evaluate(context, XPathConstants.BOOLEAN, Boolean.class); } @@ -376,7 +297,6 @@ // Overrides of Object //---------------------------------------------------------------------------- - /** * Two instances are considered equal if they have the same expression, * namespace mappings, variable mappings, and function mappings. Note @@ -450,6 +370,24 @@ /** + * Compiles and executes the expression in the context of the specified + * node, returning the specified result type. + */ + private <T> T evaluate(Node context, QName returnType, Class<T> castTo) + { + compileIfNeeded(); + try + { + return castTo.cast(_compiled.evaluate(context, returnType)); + } + catch (Exception ee) + { + throw new XmlException("unable to evaluate: " + _expr, ee); + } + } + + + /** * Resolver for variable references. */ private class MyVariableResolver Modified: trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java =================================================================== --- trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java 2008-12-30 14:01:57 UTC (rev 69) +++ trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java 2008-12-30 14:08:10 UTC (rev 70) @@ -104,7 +104,7 @@ List<Node> result1 = xpath.evaluate(_dom); assertEquals(1, result1.size()); - assertSame(_root, result1.get(0)); + assertSame(_dom, result1.get(0)); List<Node> result2 = xpath.evaluate(_root); assertEquals(1, result2.size()); @@ -123,9 +123,7 @@ _root.setAttribute("argle", "bargle"); XPathWrapper xpath = new XPathWrapper("@foo"); - assertEquals("bar", xpath.evaluateAsString(_root)); - assertEquals("bar", xpath.evaluateAsString(_dom)); } @@ -135,9 +133,7 @@ _root.setAttribute("foo", "10"); XPathWrapper xpath = new XPathWrapper("@foo"); - - assertEquals(Double.valueOf(10.0), xpath.evaluateAsNumber(_root)); - assertEquals(Double.valueOf(10.0), xpath.evaluateAsNumber(_dom)); + assertEquals(10, xpath.evaluateAsNumber(_root).intValue()); } @@ -147,14 +143,13 @@ _root.setAttribute("foo", "10"); XPathWrapper xpath1 = new XPathWrapper("@foo=10"); - assertTrue(xpath1.evaluateAsBoolean(_root).booleanValue()); - assertTrue(xpath1.evaluateAsBoolean(_dom).booleanValue()); _root.setAttribute("foo", "20"); - assertFalse(xpath1.evaluateAsBoolean(_root).booleanValue()); - assertFalse(xpath1.evaluateAsBoolean(_dom).booleanValue()); + + XPathWrapper xpath2 = new XPathWrapper("."); + assertTrue(xpath2.evaluateAsBoolean(_root).booleanValue()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2009-04-28 17:54:28
|
Revision: 80 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=80&view=rev Author: kdgregory Date: 2009-04-28 17:54:17 +0000 (Tue, 28 Apr 2009) Log Message: ----------- XmlBuilder: output routines now properly handle comments (using SAX extension class) Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/builder/CommentNode.java trunk/src/main/java/net/sf/practicalxml/builder/ElementNode.java trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilder.java trunk/src/test/java/net/sf/practicalxml/builder/TestXmlBuilder.java Modified: trunk/src/main/java/net/sf/practicalxml/builder/CommentNode.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/builder/CommentNode.java 2009-04-27 12:41:46 UTC (rev 79) +++ trunk/src/main/java/net/sf/practicalxml/builder/CommentNode.java 2009-04-28 17:54:17 UTC (rev 80) @@ -16,6 +16,9 @@ import org.w3c.dom.Comment; import org.w3c.dom.Element; +import org.xml.sax.ContentHandler; +import org.xml.sax.SAXException; +import org.xml.sax.ext.LexicalHandler; /** @@ -40,4 +43,14 @@ Comment node = parent.getOwnerDocument().createComment(_content); parent.appendChild(node); } + + + @Override + protected void toSAX(ContentHandler handler) throws SAXException + { + if (handler instanceof LexicalHandler) + { + ((LexicalHandler)handler).comment(_content.toCharArray(), 0, _content.length()); + } + } } Modified: trunk/src/main/java/net/sf/practicalxml/builder/ElementNode.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/builder/ElementNode.java 2009-04-27 12:41:46 UTC (rev 79) +++ trunk/src/main/java/net/sf/practicalxml/builder/ElementNode.java 2009-04-28 17:54:17 UTC (rev 80) @@ -85,8 +85,10 @@ /** - * Invokes the passed <code>ContentHandler</code> for this element - * and its children. + * Invokes the passed <code>ContentHandler</code> for this element and + * its children. Note that the implementation class must also implement + * <code>LexicalHandler</code> to receive events from all nodes in the + * tree (particularly comments). */ @Override protected void toSAX(ContentHandler handler) @@ -106,12 +108,6 @@ * not insert whitespace between elements. Note that you <em>must</em> * use UTF-8 encoding or add a prologue that specifies encoding when * writing this string to a stream. - * <p> - * <em>Warning:</em> - * This method uses a SAX transformer, to minimize footprint. However, - * SAX does not support comment modes, so they will be silently dropped. - * If they are important to you, call {@link #toDOM} and use {@link - * net.sf.practicalxml.OutputUtil#compactString} to generate output. */ @Override public String toString() @@ -128,12 +124,6 @@ * This is the best choice for writing log output. If you write this string * to a stream, you <em>must</em> use UTF-8 encoding or attach a prologue * that specifies the encoding used. - * <p> - * <em>Warning:</em> - * This method uses a SAX transformer, to minimize footprint. However, - * SAX does not support comment modes, so they will be silently dropped. - * If they are important to you, call {@link #toDOM} and use {@link - * net.sf.practicalxml.OutputUtil#indentedString} to generate output. */ public String toString(int indentSize) { @@ -147,12 +137,6 @@ * <p> * This is the best choice for writing XML that will be read by another * party. - * <p> - * <em>Warning:</em> - * This method uses a SAX transformer, to minimize footprint. However, - * SAX does not support comment modes, so they will be silently dropped. - * If they are important to you, call {@link #toDOM} and use {@link - * net.sf.practicalxml.OutputUtil#compactStream} to generate output. */ public void toStream(OutputStream out) { @@ -164,12 +148,6 @@ * Writes the tree rooted at this element to an <code>OutputStream</code>, * using a specified encoding, without a prologue or whitepspace between * nodes. - * <p> - * <em>Warning:</em> - * This method uses a SAX transformer, to minimize footprint. However, - * SAX does not support comment modes, so they will be silently dropped. - * If they are important to you, call {@link #toDOM} and use {@link - * net.sf.practicalxml.OutputUtil#compactStream} to generate output. */ public void toStream(OutputStream out, String encoding) { Modified: trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilder.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilder.java 2009-04-27 12:41:46 UTC (rev 79) +++ trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilder.java 2009-04-28 17:54:17 UTC (rev 80) @@ -97,9 +97,9 @@ /** * Creates a comment node. * <p> - * <em>Warning</em>: - * Comment nodes are not reported by SAX sources. If comments are - * important to you, convert to DOM before serialization. + * <em>Warning:</em> + * Comment nodes are only reported to SAX content handlers that also + * implement <code>org.xml.sax.ext.LexicalHandler</code>. */ public static Node comment(String text) { Modified: trunk/src/test/java/net/sf/practicalxml/builder/TestXmlBuilder.java =================================================================== --- trunk/src/test/java/net/sf/practicalxml/builder/TestXmlBuilder.java 2009-04-27 12:41:46 UTC (rev 79) +++ trunk/src/test/java/net/sf/practicalxml/builder/TestXmlBuilder.java 2009-04-28 17:54:17 UTC (rev 80) @@ -32,6 +32,7 @@ import org.w3c.dom.ProcessingInstruction; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; +import org.xml.sax.ext.LexicalHandler; import net.sf.practicalxml.AbstractTestCase; import net.sf.practicalxml.DomUtil; @@ -72,7 +73,7 @@ { return (ContentHandler)Proxy.newProxyInstance( ContentHandler.class.getClassLoader(), - new Class[] { ContentHandler.class }, + new Class[] { ContentHandler.class, LexicalHandler.class }, this); } @@ -82,7 +83,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - // this is a hack for characters + // this is a hack for characters() and comment() for (int ii = 0 ; ii < args.length ; ii++) { if (args[ii] instanceof char[]) @@ -276,11 +277,11 @@ // note: ContentHandler knows nothing of comments MockContentHandler handler = new MockContentHandler(); node.toSAX(handler.getHandler()); - handler.assertInvocationSequence("startElement", "endElement"); + handler.assertInvocationSequence("startElement", "comment", "endElement"); handler.assertInvocation(0, "startElement", null, "foo", "foo"); + handler.assertInvocation(1, "comment", "bar", 0, 3); - -// assertEquals("<foo><!--bar--></foo>", node.toString()); + assertEquals("<foo><!--bar--></foo>", node.toString()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2009-09-16 20:46:44
|
Revision: 133 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=133&view=rev Author: kdgregory Date: 2009-09-16 20:46:30 +0000 (Wed, 16 Sep 2009) Log Message: ----------- DomUtil: - added filter(), use it internally - appendText() now returns the created node Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/DomUtil.java trunk/src/site/changes.xml trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java Modified: trunk/src/main/java/net/sf/practicalxml/DomUtil.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2009-09-15 18:37:09 UTC (rev 132) +++ trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2009-09-16 20:46:30 UTC (rev 133) @@ -15,6 +15,7 @@ package net.sf.practicalxml; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import javax.xml.namespace.NamespaceContext; import javax.xml.parsers.DocumentBuilder; @@ -197,17 +198,7 @@ */ public static List<Element> getChildren(Element parent) { - List<Element> ret = new ArrayList<Element>(); - NodeList children = parent.getChildNodes(); - for (int ii = 0 ; ii < children.getLength() ; ii++) - { - Node child = children.item(ii); - if (child instanceof Element) - { - ret.add((Element)child); - } - } - return ret; + return filter(parent.getChildNodes(), Element.class); } @@ -216,45 +207,39 @@ * <em>localname</em>, ignoring namespace. * <p> * Returns the children in document order. Returns an empty list if - * there are no children matching the specified name. + * there are no children matching the specified namespace/name. */ public static List<Element> getChildren(Element parent, String lclName) { - List<Element> ret = new ArrayList<Element>(); - NodeList children = parent.getChildNodes(); - for (int ii = 0 ; ii < children.getLength() ; ii++) + List<Element> ret = getChildren(parent); + Iterator<Element> itx = ret.iterator(); + while (itx.hasNext()) { - Node child = children.item(ii); - if ((child instanceof Element) - && (lclName.equals(getLocalName((Element)child)))) - { - ret.add((Element)child); - } + Element child = itx.next(); + if (!lclName.equals(getLocalName((Element)child))) + itx.remove(); } return ret; } /** - * Returns the children of the passed element that have the given - * namespace and <em>localname</em> (ignoring prefix). Namespace may - * be <code>null</code>, in which case the child element must not - * have a namespace. + * Returns the children of the passed element that have the given namespace + * and localname (ignoring prefix). Namespace may be <code>null</code>, in + * which case the child element must not have a namespace. * <p> * Returns the children in document order. Returns an empty list if * there are no children matching the specified namespace/name. */ public static List<Element> getChildren(Element parent, String nsUri, String lclName) { - List<Element> ret = new ArrayList<Element>(); - NodeList children = parent.getChildNodes(); - for (int ii = 0 ; ii < children.getLength() ; ii++) + List<Element> ret = getChildren(parent); + Iterator<Element> itx = ret.iterator(); + while (itx.hasNext()) { - Node child = children.item(ii); - if ((child instanceof Element) && isNamed((Element)child, nsUri, lclName)) - { - ret.add((Element)child); - } + Element child = itx.next(); + if (!isNamed(child, nsUri, lclName)) + itx.remove(); } return ret; } @@ -283,13 +268,13 @@ /** - * Returns text that is an immediate child of this node. This is - * unlike <code>Node.getTextContent()</code>, which returns all - * descendent text for the element. + * Returns the concatenation of all text and CDATA nodes that are immediate + * children of the passed node. If there are no text/CDATA nodes, returns + * <code>null</code>. * <p> - * Concatenates all text and CDATA nodes, does not trim whitespace. - * If there are no text nodes, returns <code>null</code>; if all - * text nodes contain empty strings, returns an empty string. + * This method differs from <code>Node.getTextContent()</code> in two ways: + * the latter concatenates all descendent text nodes, and will return an + * empty string (rather than <code>null</code>) if there are none. */ public static String getText(Element elem) { @@ -309,7 +294,6 @@ break; default : // do nothing - } } @@ -321,10 +305,11 @@ * Appends the specified text as a new text node on the specified * element. */ - public static void appendText(Element elem, String text) + public static Text appendText(Element elem, String text) { Text child = elem.getOwnerDocument().createTextNode(text); elem.appendChild(child); + return child; } @@ -453,7 +438,7 @@ /** - * Creates a paramaterized list from a <code>NodeList</code>, making it + * Creates a parameterized list from a <code>NodeList</code>, making it * usable within the Java coding idiom. * * @param nodelist The list of nodes to convert. @@ -475,6 +460,26 @@ /** + * Extracts all nodes of a given type from the passed NodeList, creating + * a Java list of the nodes in document order. + * + * @param list The source list, which may contain any node type. + * @param klass The desired node type to extract from this list. + */ + public static <T> List<T> filter(NodeList list, Class<T> klass) + { + ArrayList<T> result = new ArrayList<T>(); + for (int ii = 0 ; ii < list.getLength() ; ii++) + { + Node node = list.item(ii); + if (klass.isInstance(node)) + result.add(klass.cast(node)); + } + return result; + } + + + /** * Returns the path from the root of the document to the specified * element, consisting of each node's qualified name, separated by * slashes. Accepts an arbitrary number of attribute names, and Modified: trunk/src/site/changes.xml =================================================================== --- trunk/src/site/changes.xml 2009-09-15 18:37:09 UTC (rev 132) +++ trunk/src/site/changes.xml 2009-09-16 20:46:30 UTC (rev 133) @@ -5,11 +5,17 @@ <body> <release version="1.0.5" date="2009-09-15" - description="DomAsserts"> + description="DomAsserts, DomUtil"> <action dev='kdgregory' type='update'> DomAsserts: XPath assertions now take any node as initial context </action> + <action dev='kdgregory' type='add'> + DomUtil: Add filter(NodeList) + </action> + <action dev='kdgregory' type='update'> + DomUtil: appendText() now returns the created node + </action> </release> <release version="1.0.4" date="2009-09-10" Modified: trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java =================================================================== --- trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2009-09-15 18:37:09 UTC (rev 132) +++ trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2009-09-16 20:46:30 UTC (rev 133) @@ -16,8 +16,11 @@ import java.util.List; +import org.w3c.dom.CDATASection; +import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.NodeList; import org.w3c.dom.Text; @@ -107,33 +110,6 @@ } - public void testGetSetAppendText() throws Exception - { - String t1 = "argle"; - String t2 = "bargle"; - String t3 = "wargle"; - - Element root = DomUtil.newDocument("foo"); - assertNull(DomUtil.getText(root)); - - DomUtil.setText(root, t1); - assertEquals(t1, DomUtil.getText(root)); - - DomUtil.appendText(root, t2); - assertEquals(t1 + t2, DomUtil.getText(root)); - - DomUtil.setText(root, t3); - assertEquals(t3, DomUtil.getText(root)); - - Element child = DomUtil.appendChildInheritNamespace(root, "bar"); - assertNull(DomUtil.getText(child)); - - DomUtil.appendText(child, t1); - assertEquals(t1, DomUtil.getText(child)); - assertEquals(t3, DomUtil.getText(root)); - } - - public void testGetLocalName() throws Exception { Element root = DomUtil.newDocument("foo"); @@ -221,39 +197,70 @@ } + public void testAppendText() throws Exception + { + Element root = DomUtil.newDocument("root"); + Text text = DomUtil.appendText(root, "blah blah"); + assertSame(text, root.getChildNodes().item(0)); + } + + public void testGetText() throws Exception { + String t1 = "argle"; + String t2 = "bargle"; + String t3 = "wargle"; + Element root = DomUtil.newDocument("foo"); - Text rootText1 = root.getOwnerDocument().createTextNode("argle"); - root.appendChild(rootText1); - Element child = root.getOwnerDocument().createElement("bargle"); - root.appendChild(child); - Text rootText2 = root.getOwnerDocument().createTextNode("wargle"); - root.appendChild(rootText2); - Text childText = root.getOwnerDocument().createTextNode("zippy"); - child.appendChild(childText); + assertNull(DomUtil.getText(root)); - assertEquals("arglewargle", DomUtil.getText(root)); + DomUtil.appendText(root, t1); + DomUtil.appendText(root, t2); + assertEquals(t1 + t2, DomUtil.getText(root)); + + Element child = DomUtil.appendChild(root, "bar"); + DomUtil.appendText(child, t3); + assertEquals(t1 + t2 + t3, root.getTextContent()); + assertEquals(t1 + t2, DomUtil.getText(root)); + assertEquals(t3, DomUtil.getText(child)); } + // this test is just here for coverage + public void testGetSetTextWithCData() throws Exception + { + String t1 = "argle"; + String t2 = "bargle"; + + Element root = DomUtil.newDocument("root"); + Document dom = root.getOwnerDocument(); + CDATASection cdata = dom.createCDATASection(t1); + root.appendChild(cdata); + + assertEquals(t1, DomUtil.getText(root)); + assertEquals(t1, root.getTextContent()); + + DomUtil.setText(root, t2); + assertEquals(t2, DomUtil.getText(root)); + assertEquals(t2, root.getTextContent()); + } + + public void testSetText() throws Exception { + String t1 = "argle"; + String t2 = "bargle"; + String t3 = "wargle"; + Element root = DomUtil.newDocument("foo"); - Text rootText1 = root.getOwnerDocument().createTextNode("argle"); - root.appendChild(rootText1); - Element child = root.getOwnerDocument().createElement("bargle"); - root.appendChild(child); - Text rootText2 = root.getOwnerDocument().createTextNode("wargle"); - root.appendChild(rootText2); - Text childText = root.getOwnerDocument().createTextNode("zippy"); - child.appendChild(childText); + Element child = DomUtil.appendChild(root, "bar"); + DomUtil.appendText(root, t1); + DomUtil.appendText(child, t2); - DomUtil.setText(root, "bar"); - assertEquals(2, root.getChildNodes().getLength()); - assertSame(child, root.getChildNodes().item(0)); - assertEquals("bar", root.getChildNodes().item(1).getTextContent()); - assertEquals("zippy", child.getTextContent()); + DomUtil.setText(root, t3); + assertEquals(t3, DomUtil.getText(root)); + assertEquals(t2, DomUtil.getText(child)); + assertEquals(t2 + t3, root.getTextContent()); } @@ -337,4 +344,40 @@ assertSame(child1, result.get(0)); assertSame(child2, result.get(1)); } + + + public void testFilterNodeList() throws Exception + { + Element root = DomUtil.newDocument("foo"); + Document dom = root.getOwnerDocument(); + Text child1 = dom.createTextNode("argle"); + root.appendChild(child1); + Element child2 = dom.createElement("bar"); + root.appendChild(child2); + Comment child3 = dom.createComment("blah blah blah"); + root.appendChild(child3); + Text child4 = dom.createTextNode("wargle"); + root.appendChild(child4); + Element child5 = dom.createElement("baz"); + root.appendChild(child5); + NodeList list = root.getChildNodes(); + + List<Element> elems = DomUtil.filter(list, Element.class); + assertEquals(2, elems.size()); + assertSame(child2, elems.get(0)); + assertSame(child5, elems.get(1)); + + List<Text> texts = DomUtil.filter(list, Text.class); + assertEquals(2, texts.size()); + assertSame(child1, texts.get(0)); + assertSame(child4, texts.get(1)); + + List<Comment> comments = DomUtil.filter(list, Comment.class); + assertEquals(1, comments.size()); + assertSame(child3, comments.get(0)); + + List<Document> docs = DomUtil.filter(list, Document.class); + assertEquals(0, docs.size()); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2009-09-16 21:29:23
|
Revision: 134 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=134&view=rev Author: kdgregory Date: 2009-09-16 21:29:12 +0000 (Wed, 16 Sep 2009) Log Message: ----------- DomUtil: getChildren(), getChild(), trimTextRecursive(), and removeEmptyTextRecursive() now take any Node (so you can pass Document as well as Element) Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/DomUtil.java trunk/src/site/changes.xml trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java Modified: trunk/src/main/java/net/sf/practicalxml/DomUtil.java =================================================================== --- trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2009-09-16 20:46:30 UTC (rev 133) +++ trunk/src/main/java/net/sf/practicalxml/DomUtil.java 2009-09-16 21:29:12 UTC (rev 134) @@ -29,6 +29,7 @@ import org.w3c.dom.Text; import net.sf.practicalxml.internal.StringUtils; +import net.sf.practicalxml.util.NodeListIterator; import net.sf.practicalxml.xpath.NamespaceResolver; @@ -193,10 +194,11 @@ /** - * Returns all <code>Element</code> children of the passed element, in - * document order. + * Returns all <code>Element</code> children of the passed node, in + * document order. Will accept any node type, although only <code>Document + * </code> and <code>Element</code> make sense. */ - public static List<Element> getChildren(Element parent) + public static List<Element> getChildren(Node parent) { return filter(parent.getChildNodes(), Element.class); } @@ -209,7 +211,7 @@ * Returns the children in document order. Returns an empty list if * there are no children matching the specified namespace/name. */ - public static List<Element> getChildren(Element parent, String lclName) + public static List<Element> getChildren(Node parent, String lclName) { List<Element> ret = getChildren(parent); Iterator<Element> itx = ret.iterator(); @@ -231,7 +233,7 @@ * Returns the children in document order. Returns an empty list if * there are no children matching the specified namespace/name. */ - public static List<Element> getChildren(Element parent, String nsUri, String lclName) + public static List<Element> getChildren(Node parent, String nsUri, String lclName) { List<Element> ret = getChildren(parent); Iterator<Element> itx = ret.iterator(); @@ -249,7 +251,7 @@ * Returns the first child element with the given <em>localname</em>, * null if there are no such nodes. */ - public static Element getChild(Element parent, String lclName) + public static Element getChild(Node parent, String lclName) { List<Element> children = getChildren(parent, lclName); return (children.size() > 0) ? children.get(0) : null; @@ -260,7 +262,7 @@ * Returns the first child element with the given namespace and * local name, null if there are no such elements. */ - public static Element getChild(Element parent, String nsUri, String lclName) + public static Element getChild(Node parent, String nsUri, String lclName) { List<Element> children = getChildren(parent, nsUri, lclName); return (children.size() > 0) ? children.get(0) : null; @@ -346,12 +348,12 @@ * Removes leading and trailing whitespace from all descendent text * nodes. Will remove text nodes that trim to an empty string. */ - public static void trimTextRecursive(Element elem) + public static void trimTextRecursive(Node node) { - NodeList children = elem.getChildNodes(); - for (int ii = children.getLength() - 1 ; ii >= 0 ; ii--) + Iterator<Node> itx = new NodeListIterator(node.getChildNodes()); + while (itx.hasNext()) { - Node child = children.item(ii); + Node child = itx.next(); switch (child.getNodeType()) { case Node.ELEMENT_NODE : @@ -361,7 +363,7 @@ case Node.TEXT_NODE : String value = StringUtils.trimToEmpty(((Text)child).getData()); if (StringUtils.isEmpty(value)) - elem.removeChild(child); + itx.remove(); else ((Text)child).setData(value); break; @@ -378,12 +380,12 @@ * could be removed by by the parser if you had a DTD that specified * element-only content. */ - public static void removeEmptyTextRecursive(Element elem) + public static void removeEmptyTextRecursive(Node node) { - NodeList children = elem.getChildNodes(); - for (int ii = children.getLength() - 1 ; ii >= 0 ; ii--) + Iterator<Node> itx = new NodeListIterator(node.getChildNodes()); + while (itx.hasNext()) { - Node child = children.item(ii); + Node child = itx.next(); switch (child.getNodeType()) { case Node.ELEMENT_NODE : @@ -392,7 +394,7 @@ case Node.CDATA_SECTION_NODE : case Node.TEXT_NODE : if (StringUtils.isBlank(child.getNodeValue())) - elem.removeChild(child); + itx.remove(); break; default : // do nothing Modified: trunk/src/site/changes.xml =================================================================== --- trunk/src/site/changes.xml 2009-09-16 20:46:30 UTC (rev 133) +++ trunk/src/site/changes.xml 2009-09-16 21:29:12 UTC (rev 134) @@ -11,11 +11,16 @@ initial context </action> <action dev='kdgregory' type='add'> - DomUtil: Add filter(NodeList) + DomUtil: Add filter() </action> <action dev='kdgregory' type='update'> DomUtil: appendText() now returns the created node </action> + <action dev='kdgregory' type='update'> + DomUtil: getChildren(), getChild(), trimTextRecursive(), + and removeEmptyTextRecursive() now take any Node (so you + can pass Document as well as Element) + </action> </release> <release version="1.0.4" date="2009-09-10" Modified: trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java =================================================================== --- trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2009-09-16 20:46:30 UTC (rev 133) +++ trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java 2009-09-16 21:29:12 UTC (rev 134) @@ -162,7 +162,7 @@ } - public void testGetChildren() throws Exception + public void testGetChildrenOfElement() throws Exception { Element root = DomUtil.newDocument("foo"); DomUtil.appendText(root, "bar"); @@ -197,6 +197,62 @@ } + + public void testGetChildrenOfDocument() throws Exception + { + Element root1 = DomUtil.newDocument("foo"); + Document dom1 = root1.getOwnerDocument(); + + assertSame(root1, DomUtil.getChild(dom1, "foo")); + assertNull(DomUtil.getChild(dom1, "bar")); + + List<Element> rslt1a = DomUtil.getChildren(dom1); + assertEquals(1, rslt1a.size()); + assertSame(root1, rslt1a.get(0)); + + List<Element> rslt1b = DomUtil.getChildren(dom1, "foo"); + assertEquals(1, rslt1b.size()); + assertSame(root1, rslt1b.get(0)); + + List<Element> rslt1c = DomUtil.getChildren(dom1, "bar"); + assertEquals(0, rslt1c.size()); + + // and now with namespaces + + Element root2 = DomUtil.newDocument("urn:bar", "foo"); + Document dom2 = root2.getOwnerDocument(); + + assertSame(root2, DomUtil.getChild(dom2, "urn:bar", "foo")); + assertNull(DomUtil.getChild(dom2, "urn:bar", "bar")); + + List<Element> rslt2a = DomUtil.getChildren(dom2); + assertEquals(1, rslt2a.size()); + assertSame(root2, rslt2a.get(0)); + + List<Element> rslt2b = DomUtil.getChildren(dom2, "urn:bar", "foo"); + assertEquals(1, rslt2b.size()); + assertSame(root2, rslt2b.get(0)); + + List<Element> rslt2c = DomUtil.getChildren(dom2, "urn:bar", "bar"); + assertEquals(0, rslt2c.size()); + + List<Element> rslt2d = DomUtil.getChildren(dom2, "bar"); + assertEquals(0, rslt2d.size()); + } + + + // ensure that we don't throw if we pass something dumb + public void testGetChildrenOfComment() throws Exception + { + Element root = DomUtil.newDocument("foo"); + Comment comment = root.getOwnerDocument().createComment("blah blah blah"); + root.appendChild(comment); + + List<Element> result = DomUtil.getChildren(comment); + assertEquals(0, result.size()); + } + + public void testAppendText() throws Exception { Element root = DomUtil.newDocument("root"); @@ -284,7 +340,7 @@ assertEquals(TEXT1, child1.getTextContent()); assertEquals(TEXT2_WS, child2.getTextContent()); - DomUtil.trimTextRecursive(root); + DomUtil.trimTextRecursive(root.getOwnerDocument()); assertEquals(TEXT1, child1.getTextContent()); assertEquals("", child2.getTextContent()); assertEquals(0, child2.getChildNodes().getLength()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-08 02:01:36
|
Revision: 190 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=190&view=rev Author: kdgregory Date: 2010-01-08 02:01:28 +0000 (Fri, 08 Jan 2010) Log Message: ----------- add CollectionConverter Added Paths: ----------- trunk/src/main/java/net/sf/practicalxml/converter/CollectionConverter.java trunk/src/test/java/net/sf/practicalxml/converter/TestCollectionConverter.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-08 15:01:52
|
Revision: 191 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=191&view=rev Author: kdgregory Date: 2010-01-08 15:01:37 +0000 (Fri, 08 Jan 2010) Log Message: ----------- DomUtil: add variant of newDocument() that takes QName Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/DomUtil.java trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-08 15:35:04
|
Revision: 192 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=192&view=rev Author: kdgregory Date: 2010-01-08 15:34:58 +0000 (Fri, 08 Jan 2010) Log Message: ----------- CollectionConverter: implement key filtering on Map->DOM conversion Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/CollectionConverter.java trunk/src/test/java/net/sf/practicalxml/converter/TestCollectionConverter.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-09 13:46:54
|
Revision: 193 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=193&view=rev Author: kdgregory Date: 2010-01-09 13:46:45 +0000 (Sat, 09 Jan 2010) Log Message: ----------- XPathWrapper: add evaluateAsStringList(), variant of evaluate() that takes result class Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-10 14:00:51
|
Revision: 194 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=194&view=rev Author: kdgregory Date: 2010-01-10 14:00:45 +0000 (Sun, 10 Jan 2010) Log Message: ----------- bugfix: XmlUtil.testParseXsdDatetime() wasn't handling the 'Z' timezone spec Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/XmlUtil.java trunk/src/test/java/net/sf/practicalxml/TestXmlUtil.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2010-01-10 14:31:27
|
Revision: 195 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=195&view=rev Author: kdgregory Date: 2010-01-10 14:31:20 +0000 (Sun, 10 Jan 2010) Log Message: ----------- XmlUtil.parseXsdDatetime(): additional checks on timezone Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/XmlUtil.java trunk/src/test/java/net/sf/practicalxml/TestXmlUtil.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-19 22:51:19
|
Revision: 217 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=217&view=rev Author: kdgregory Date: 2011-09-19 22:51:13 +0000 (Mon, 19 Sep 2011) Log Message: ----------- add XPathWrapper.clone() Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-19 23:44:58
|
Revision: 218 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=218&view=rev Author: kdgregory Date: 2011-09-19 23:44:52 +0000 (Mon, 19 Sep 2011) Log Message: ----------- bugfix: Bean2XmlConverter was throwing if object had setter without corresponding getter Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/AbstractBeanConverterTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBean2XmlConverter.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-20 22:07:16
|
Revision: 219 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=219&view=rev Author: kdgregory Date: 2011-09-20 22:07:09 +0000 (Tue, 20 Sep 2011) Log Message: ----------- BeanConverter: add support for Class, File, and TimeZone objects Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaConversionUtils.java trunk/src/main/java/net/sf/practicalxml/converter/package.html trunk/src/test/java/net/sf/practicalxml/converter/bean/AbstractBeanConverterTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBeanConverter.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaConversionUtils.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-21 14:42:09
|
Revision: 220 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=220&view=rev Author: kdgregory Date: 2011-09-21 14:42:03 +0000 (Wed, 21 Sep 2011) Log Message: ----------- BeanConverter: support Locale, Calendar Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/internal/ConversionStrings.java trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaConversionUtils.java trunk/src/test/java/net/sf/practicalxml/converter/bean/AbstractBeanConverterTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBeanConverter.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaConversionUtils.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-21 16:20:16
|
Revision: 221 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=221&view=rev Author: kdgregory Date: 2011-09-21 16:20:06 +0000 (Wed, 21 Sep 2011) Log Message: ----------- refactor: JavaConversionUtils is now an instantiable class Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaConversionUtils.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaConversionUtils.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-21 18:41:39
|
Revision: 222 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=222&view=rev Author: kdgregory Date: 2011-09-21 18:41:32 +0000 (Wed, 21 Sep 2011) Log Message: ----------- rename (internal) JavaConversionUtils to JavaStringConversions Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java Added Paths: ----------- trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaStringConversions.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaStringConversions.java Removed Paths: ------------- trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaConversionUtils.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaConversionUtils.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-21 20:42:53
|
Revision: 225 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=225&view=rev Author: kdgregory Date: 2011-09-21 20:42:46 +0000 (Wed, 21 Sep 2011) Log Message: ----------- update copyright notices Modified Paths: -------------- trunk/src/example/java/net/sf/practicalxml/example/BuilderExample.java trunk/src/main/java/net/sf/practicalxml/DomUtil.java trunk/src/main/java/net/sf/practicalxml/OutputUtil.java trunk/src/main/java/net/sf/practicalxml/ParseUtil.java trunk/src/main/java/net/sf/practicalxml/SchemaUtil.java trunk/src/main/java/net/sf/practicalxml/XmlException.java trunk/src/main/java/net/sf/practicalxml/XmlUtil.java trunk/src/main/java/net/sf/practicalxml/builder/AttributeNode.java trunk/src/main/java/net/sf/practicalxml/builder/CommentNode.java trunk/src/main/java/net/sf/practicalxml/builder/ElementNode.java trunk/src/main/java/net/sf/practicalxml/builder/Node.java trunk/src/main/java/net/sf/practicalxml/builder/PINode.java trunk/src/main/java/net/sf/practicalxml/builder/TextNode.java trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilder.java trunk/src/main/java/net/sf/practicalxml/builder/XmlBuilderException.java trunk/src/main/java/net/sf/practicalxml/converter/BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/CollectionConverter.java trunk/src/main/java/net/sf/practicalxml/converter/ConversionException.java trunk/src/main/java/net/sf/practicalxml/converter/JsonConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlAppenders.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlOptions.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Introspection.java trunk/src/main/java/net/sf/practicalxml/converter/bean/IntrospectionCache.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanOptions.java trunk/src/main/java/net/sf/practicalxml/converter/internal/ConversionStrings.java trunk/src/main/java/net/sf/practicalxml/converter/internal/ConversionUtils.java trunk/src/main/java/net/sf/practicalxml/converter/internal/JavaStringConversions.java trunk/src/main/java/net/sf/practicalxml/converter/internal/JsonUtils.java trunk/src/main/java/net/sf/practicalxml/converter/internal/TypeUtils.java trunk/src/main/java/net/sf/practicalxml/converter/json/Json2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/json/Json2XmlOptions.java trunk/src/main/java/net/sf/practicalxml/converter/json/Xml2JsonConverter.java trunk/src/main/java/net/sf/practicalxml/converter/json/Xml2JsonOptions.java trunk/src/main/java/net/sf/practicalxml/internal/StringUtils.java trunk/src/main/java/net/sf/practicalxml/internal/TransformerFactoryHelper.java trunk/src/main/java/net/sf/practicalxml/junit/DomAsserts.java trunk/src/main/java/net/sf/practicalxml/util/ErrorHandlerAdapter.java trunk/src/main/java/net/sf/practicalxml/util/ExceptionErrorHandler.java trunk/src/main/java/net/sf/practicalxml/util/NodeListIterable.java trunk/src/main/java/net/sf/practicalxml/util/NodeListIterator.java trunk/src/main/java/net/sf/practicalxml/util/SimpleXMLReader.java trunk/src/main/java/net/sf/practicalxml/util/XMLFilterImplBridge.java trunk/src/main/java/net/sf/practicalxml/xpath/AbstractFunction.java trunk/src/main/java/net/sf/practicalxml/xpath/FunctionResolver.java trunk/src/main/java/net/sf/practicalxml/xpath/NamespaceResolver.java trunk/src/main/java/net/sf/practicalxml/xpath/SimpleNamespaceResolver.java trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/main/java/net/sf/practicalxml/xpath/function/Constants.java trunk/src/main/java/net/sf/practicalxml/xpath/function/Lowercase.java trunk/src/main/java/net/sf/practicalxml/xpath/function/Uppercase.java trunk/src/main/java/net/sf/practicalxml/xpath/function/XsiBoolean.java trunk/src/perftest/java/net/sf/practicalxml/perftest/AbstractPerformanceTest.java trunk/src/perftest/java/net/sf/practicalxml/perftest/converter/BeanExerciser.java trunk/src/perftest/java/net/sf/practicalxml/perftest/converter/JsonExerciser.java trunk/src/test/java/net/sf/practicalxml/AbstractTestCase.java trunk/src/test/java/net/sf/practicalxml/TestDomUtil.java trunk/src/test/java/net/sf/practicalxml/TestDomUtilGetPath.java trunk/src/test/java/net/sf/practicalxml/TestOutputUtil.java trunk/src/test/java/net/sf/practicalxml/TestParseUtil.java trunk/src/test/java/net/sf/practicalxml/TestSchemaUtil.java trunk/src/test/java/net/sf/practicalxml/TestXmlUtil.java trunk/src/test/java/net/sf/practicalxml/builder/TestXmlBuilder.java trunk/src/test/java/net/sf/practicalxml/converter/AbstractConversionTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/TestCollectionConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/AbstractBeanConverterTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBean2XmlAppenders.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBean2XmlConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBeanConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestIntrospection.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestIntrospectionCache.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestXml2BeanConverter.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJavaStringConversions.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestJsonUtils.java trunk/src/test/java/net/sf/practicalxml/converter/internal/TestTypeUtils.java trunk/src/test/java/net/sf/practicalxml/converter/json/TestJson2XmlConverter.java trunk/src/test/java/net/sf/practicalxml/converter/json/TestJsonConverter.java trunk/src/test/java/net/sf/practicalxml/converter/json/TestXml2JsonConverter.java trunk/src/test/java/net/sf/practicalxml/internal/TestStringUtils.java trunk/src/test/java/net/sf/practicalxml/junit/TestDomAsserts.java trunk/src/test/java/net/sf/practicalxml/util/TestNodeListIterable.java trunk/src/test/java/net/sf/practicalxml/util/TestNodeListIterator.java trunk/src/test/java/net/sf/practicalxml/util/TestSimpleXMLReader.java trunk/src/test/java/net/sf/practicalxml/xpath/TestAbstractFunction.java trunk/src/test/java/net/sf/practicalxml/xpath/TestFunctionResolver.java trunk/src/test/java/net/sf/practicalxml/xpath/TestNamespaceResolver.java trunk/src/test/java/net/sf/practicalxml/xpath/TestSimpleNamespaceResolver.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/function/TestLowercase.java trunk/src/test/java/net/sf/practicalxml/xpath/function/TestUppercase.java trunk/src/test/java/net/sf/practicalxml/xpath/function/TestXsiBoolean.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-09-22 14:37:28
|
Revision: 226 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=226&view=rev Author: kdgregory Date: 2011-09-22 14:37:22 +0000 (Thu, 22 Sep 2011) Log Message: ----------- BeanConverter: improve exception reporting Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/ConversionException.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlConverter.java trunk/src/main/java/net/sf/practicalxml/converter/bean/Xml2BeanConverter.java trunk/src/site/changes.xml Added Paths: ----------- trunk/src/test/java/net/sf/practicalxml/converter/TestConversionException.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-10-06 14:19:53
|
Revision: 227 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=227&view=rev Author: kdgregory Date: 2011-10-06 14:19:44 +0000 (Thu, 06 Oct 2011) Log Message: ----------- BeanConverter: handle nested collections Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/converter/bean/Bean2XmlAppenders.java trunk/src/test/java/net/sf/practicalxml/converter/AbstractConversionTestCase.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBean2XmlConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestBeanConverter.java trunk/src/test/java/net/sf/practicalxml/converter/bean/TestXml2BeanConverter.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-11-01 12:34:41
|
Revision: 228 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=228&view=rev Author: kdgregory Date: 2011-11-01 12:34:30 +0000 (Tue, 01 Nov 2011) Log Message: ----------- Add XsiUtil, starting with accessors for xsi:nil Added Paths: ----------- trunk/src/main/java/net/sf/practicalxml/XsiUtil.java trunk/src/test/java/net/sf/practicalxml/TestXsiUtil.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-12-20 02:33:27
|
Revision: 229 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=229&view=rev Author: kdgregory Date: 2011-12-20 02:33:21 +0000 (Tue, 20 Dec 2011) Log Message: ----------- add ParseUtil.parse(File) Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/ParseUtil.java trunk/src/test/java/net/sf/practicalxml/TestParseUtil.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-12-20 12:42:57
|
Revision: 231 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=231&view=rev Author: kdgregory Date: 2011-12-20 12:42:50 +0000 (Tue, 20 Dec 2011) Log Message: ----------- add XPathWrapper.evaluateAsElement(Node) Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2011-12-20 13:07:17
|
Revision: 232 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=232&view=rev Author: kdgregory Date: 2011-12-20 13:07:10 +0000 (Tue, 20 Dec 2011) Log Message: ----------- XPathWrapper.evaluate(Node, Class<T>) now applies a filter, not a cast Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/XPathWrapper.java trunk/src/test/java/net/sf/practicalxml/xpath/TestXPathWrapper.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Auto-Generated S. C. M. <pra...@li...> - 2012-05-11 12:15:27
|
Revision: 238 http://practicalxml.svn.sourceforge.net/practicalxml/?rev=238&view=rev Author: kdgregory Date: 2012-05-11 12:15:16 +0000 (Fri, 11 May 2012) Log Message: ----------- FunctionResolver: add clone(), toString() Modified Paths: -------------- trunk/src/main/java/net/sf/practicalxml/xpath/FunctionResolver.java trunk/src/test/java/net/sf/practicalxml/xpath/TestFunctionResolver.java Added Paths: ----------- trunk/src/test/java/net/sf/practicalxml/xpath/XPathTestHelpers.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |