You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
|
May
(2) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(2) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2007 |
Jan
(12) |
Feb
(17) |
Mar
(13) |
Apr
(20) |
May
(36) |
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(11) |
Dec
(5) |
2008 |
Jan
(9) |
Feb
(3) |
Mar
(19) |
Apr
(20) |
May
(8) |
Jun
(18) |
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
(3) |
Apr
(6) |
May
(12) |
Jun
(6) |
Jul
(2) |
Aug
(2) |
Sep
(5) |
Oct
(4) |
Nov
(2) |
Dec
(2) |
2010 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(3) |
May
(5) |
Jun
(2) |
Jul
|
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
|
Dec
(3) |
2011 |
Jan
(2) |
Feb
(10) |
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(7) |
Oct
(4) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
(3) |
Mar
(1) |
Apr
(13) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(17) |
2015 |
Jan
(28) |
Feb
(33) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
(2) |
Dec
(1) |
2016 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(3) |
Dec
(4) |
2022 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Mani, S. <San...@NB...> - 2003-10-10 03:19:03
|
Hi List, I have a business method that returns an object hierarchy as XML. I'd like to write tests in which the controlXML has tags that have a subset of the attributes present in the corresponding testXML. This subset would consist of only those attributes I'm interested in testing. Any pointers on how I can achive this appreciated? Thanks in advance, Santosh This communication is confidential and may contain privileged material. If you are not the intended recipient you must not use, disclose, copy or retain it. If you have received it in error please immediately notify me by return email and delete the emails. Thank you. |
From: Eli T. <sou...@ne...> - 2003-07-01 17:10:39
|
I'm curious how it would be possible to write a DifferenceListener that ignores all attributes in a given namespace. The problem I'm running into is that differences in attributes are reported at the org.w3c.dom.Element level (i.e., the both the test and control nodes are Elements, even though the difference is in the attribute). Here's the relevant section of code I currently have: public int differenceFound( Difference difference ) { int returnValue =3D RETURN_ACCEPT_DIFFERENCE; Node controlNode =3D difference.getControlNodeDetail().getNode(); Node testNode =3D difference.getTestNodeDetail().getNode(); if ( "backendData".equals( controlNode.getNamespaceURI() )) { System.out.println( "Found backendData URI for node " + controlNode ); returnValue =3D RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR; } if ( difference.getDescription().equals( "number of element attributes" ) ) { returnValue =3D RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR; } return returnValue; } Here's the test that I'm using that needs to pass: public void testIgnoreBackendDataNamespaces() throws Exception { String control =3D "<foo xmlns:ignore=3D\"backendData\" ignore:a=3D\"whatever\" />"; String test =3D "<foo xmlns:ignore=3D\"backendData\" />"; Diff diff =3D new Diff( control, test ); diff.overrideDifferenceListener( new MyDifferenceListener() ); assertXMLEqual( diff, true ); } Might it be preferable to have XML Unit pass in the Attr nodes in the Difference object rather than the Element nodes when in actuality it is the Attr that is different? Or is there another way I can do this? Thanks for your help. - Eli |
From: Eli T. <sou...@ne...> - 2003-06-27 18:17:04
|
Hi Jeff. I'm relatively new to this stuff. Could you give more details on how that might be possible? Thanks, Eli > -----Original Message----- > From: xml...@li... [mailto:xmlunit- > gen...@li...] On Behalf Of Jeff Martin > Sent: Friday, June 27, 2003 3:03 AM > To: xml...@li... > Subject: Re: [Xmlunit-general] Comparing subsections of a document >=20 > Should be able to do this using xpath. >=20 > On Fri, 2003-06-27 at 00:15, Eli Tucker wrote: > > Is it possible to compare two documents starting at a given Node in > the > > tree and examining only that Node and deeper nodes? What would it > take > > to add this functionality? > > > > I haphazardly tried converting the Diff constructor to take two > Nodes > > rather than two Documents, but that planned failed as different > > documents would result as being similar. > > > > - Eli > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: INetU > > Attention Web Developers & Consultants: Become An INetU Hosting > Partner. > > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly > Commission! > > INetU Dedicated Managed Hosting > http://www.inetu.net/partner/index.php > > _______________________________________________ > > Xmlunit-general mailing list > > Xml...@li... > > https://lists.sourceforge.net/lists/listinfo/xmlunit-general > -- > Jeff Martin >=20 > Memetic Engineer >=20 > http://www.custommonkey.org/ >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting > Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly > Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general |
From: Jeff M. <je...@cu...> - 2003-06-27 10:02:20
|
Should be able to do this using xpath. On Fri, 2003-06-27 at 00:15, Eli Tucker wrote: > Is it possible to compare two documents starting at a given Node in the > tree and examining only that Node and deeper nodes? What would it take > to add this functionality? > > I haphazardly tried converting the Diff constructor to take two Nodes > rather than two Documents, but that planned failed as different > documents would result as being similar. > > - Eli > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |
From: Eli T. <sou...@ne...> - 2003-06-26 23:15:45
|
Is it possible to compare two documents starting at a given Node in the tree and examining only that Node and deeper nodes? What would it take to add this functionality? I haphazardly tried converting the Diff constructor to take two Nodes rather than two Documents, but that planned failed as different documents would result as being similar. - Eli |
From: Eli T. <sou...@ne...> - 2003-06-25 18:02:26
|
I ran into a problem when using a DetailedDiff while using an overrideDifferenceListener(). I thought I would post it here in case other people run into the same problem. Below is a slightly modified version of the testCompareToSkeletonXML example: public void testCompareToSkeletonXML() throws Exception { String myControlXML =3D "<location><street-address>22 anystreet</street-address><postcode>XY00 99Z</postcode></location>"; String myTestXML =3D "<location><street-address>20 eastcheap</street-address><postcode>EC3M 1EB</postcode></location>"; DifferenceListener myDifferenceListener =3D new IgnoreTextAndAttributeValuesDifferenceListener(); Diff myDiff =3D new Diff(myControlXML, myTestXML); myDiff.overrideDifferenceListener(myDifferenceListener); // This works fine: assertTrue("test XML matches control skeleton XML", myDiff.similar()); DetailedDiff myDetailedDiff =3D new DetailedDiff(myDiff); // Without this line, the test fails: //myDetailedDiff.overrideDifferenceListener(myDifferenceListener); assertTrue("Does not work with detailed diff", myDetailedDiff.similar()); } The point is that you must override the difference listener on the detailedDiff object that you are using, otherwise the difference listener you specified will not be used. I'm not sure of a way the code could be changed to work around this or to make the problem more obvious so others don't run into the same issue in the future. =20 - Eli Tucker http://nerdmonkey.com |
From: Jeff M. <je...@mk...> - 2003-05-08 09:19:53
|
Looks cool, bit busy at the moment though so it might take me a couple of days to look at this properly. Catalog support sounds good, so i'd be happy to consider anything you come up with. On Thu, 2003-05-08 at 07:56, Luca Dall'Olio wrote: > I have really appreciated your enhancement to the Validator class > including the useXMLSchema() method; now I can validate my xml using xsd > schema. > Still, I couldn't find out how to redirect the retrival of xsd files : > they are always supposed to be in the project home directory (or the ant > home, depending on the build tool I use). > After some code digging I suppose that the current way to redirect files > works only for DTDs, so I tried to extend it for xsd too. > I have not written a clean solution but it seems to work, so I thought > better to post it : perhaps it could be useful for others too. > My solution is based on an extension of the DoctypeReader class (this > way I can pass it to the Validator constructor) that parses the input, > adds a couple of attributes to the root element with the xsd info and > serializes it back to a string... very similar to the doctypeReader > itself. I have written a simple helper class to use the assertXMLValid() > interface, it can be useful as an example of the calling. > This is the way I call it : > > private String xsdName = "ordinativoFirmato.xsd"; > private String xsdPath = > this.getClass().getResource(xsdName).toString(); > > ... > > MyXMLAssert.assertXMLValid(supposedNormalizedString, xsdName, > xsdPath); > > I think that a much cleaner way to solve this problem would be to make > use of oasis catalogs : > > http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=entity > > An implementation can be downloaded at the apache site in the xml > commons package, and IMVHO it should be rather straightforward to add it > to xmlunit: > > http://xml.apache.org/commons/ > > If you are interested I can have a look at it, just let me know! > > greetings, Luca Dall'Olio (dal...@un...) > > ______________________________________________________________________ > /* > * Created on May 5, 2003 > * > * To change the template for this generated file go to > * Window>Preferences>Java>Code Generation>Code and Comments > */ > package it.unimaticaspa.unimoney.utils; > > import java.io.IOException; > import java.io.Reader; > import java.io.StringReader; > import java.io.StringWriter; > import java.util.Properties; > > import javax.xml.parsers.DocumentBuilder; > import javax.xml.parsers.DocumentBuilderFactory; > import javax.xml.parsers.ParserConfigurationException; > import javax.xml.transform.OutputKeys; > import javax.xml.transform.Transformer; > import javax.xml.transform.TransformerConfigurationException; > import javax.xml.transform.TransformerException; > import javax.xml.transform.TransformerFactory; > import javax.xml.transform.dom.DOMSource; > import javax.xml.transform.stream.StreamResult; > > import org.custommonkey.xmlunit.DoctypeReader; > import org.w3c.dom.Document; > import org.w3c.dom.Element; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; > > /** > * First written at : May 5, 2003 10:14:16 AM > * Project : unimoney > * Package : it.unimaticaspa.unimoney.utils > * File : SchemaReader.java > * Type : SchemaReader > * @author ldallolio Luca Dall'Olio lda...@un... > * > * To change the template for this generated type comment go to > * Window>Preferences>Java>Code Generation>Code and Comments > */ > public class SchemaReader extends DoctypeReader { > > private String _xsdName = null; > private String _systemID = null; > private Reader replacementReader; > > /** > * Create a Reader whose XML content is provided by the originalSource with > * the exception of the xsd schema which is provided by the xsdName > * and systemID. > * @param originalSource > * @param doctypeName > * @param systemID > */ > public SchemaReader( > Reader originalSource, > String xsdName, > String systemID) { > super(originalSource, xsdName, systemID); > this._xsdName = xsdName; > this._systemID = systemID; > } > > /* (non-Javadoc) > * @see java.io.Reader#close() > */ > public void close() throws IOException { > this.replacementReader.close(); > } > > /** > * @return the content of the original source, without amendments or > * substitutions. Safe to call multiple times. > * @throws IOException if thrown while reading from the original source > */ > protected String getContent() throws IOException { > return super.getContent(); > } > > /** > * Read DOCTYPE-replaced content from the wrapped Reader > * @param cbuf > * @param off > * @param len > * @return The number of characters read, or -1 if the end of the > * stream has been reached > * @throws IOException > */ > public int read(char cbuf[], int off, int len) throws IOException { > if (replacementReader == null) { > replacementReader = getReplacementReader(); > } > return replacementReader.read(cbuf, off, len); > } > > /** > * Perform DOCTYPE amendment / addition within some marked-up content > * @param withinContent > * @param doctypeName > * @param systemId > * @return the content, after DOCTYPE amendment / addition > */ > public String replaceDoctype( > StringBuffer withinContent, > String xsdName, > String systemId) { > String content = withinContent.toString(); > > Document domContent = null; > try { > DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); > dbf.setNamespaceAware(true); > > DocumentBuilder db = dbf.newDocumentBuilder(); > domContent = db.parse(new InputSource(new StringReader(content))); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (ParserConfigurationException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } catch (SAXException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > Element root = domContent.getDocumentElement(); > root.setAttributeNS( > "http://www.w3.org/2000/xmlns/", > "xmlns:xsi", > "http://www.w3.org/2001/XMLSchema-instance"); > root.setAttribute("xsi:noNamespaceSchemaLocation", xsdName); > > String modifiedString = null; > try { > StringWriter writer = new StringWriter(); > StreamResult result = new StreamResult(writer); > TransformerFactory factory = TransformerFactory.newInstance(); > Transformer transformer = factory.newTransformer(); > Properties properties = transformer.getOutputProperties(); > > properties.put(OutputKeys.ENCODING, "ISO-8859-1"); > properties.put(OutputKeys.INDENT, "yes"); > transformer.setOutputProperties(properties); > > DOMSource src = new DOMSource(domContent); > transformer.transform(src, result); > modifiedString = writer.toString(); > } catch (TransformerConfigurationException e1) { > // TODO Auto-generated catch block > e1.printStackTrace(); > } catch (TransformerException e1) { > // TODO Auto-generated catch block > e1.printStackTrace(); > } > > return modifiedString; > } > > /** > * Wrap the DOCTYPE-replaced content in a StringReader > * @return a StringReader from which the DOCTYPE-replaced content can be read > * @throws IOException > */ > private Reader getReplacementReader() throws IOException { > String modified = > replaceDoctype( > new StringBuffer(super.getContent()), > this._xsdName, > this._systemID); > return new StringReader(modified); > } > > } > > ______________________________________________________________________ > /* > * Created on May 5, 2003 > * > * To change the template for this generated file go to > * Window>Preferences>Java>Code Generation>Code and Comments > */ > package it.unimaticaspa.unimoney.utils; > > import java.io.StringReader; > > import javax.xml.parsers.ParserConfigurationException; > > import org.custommonkey.xmlunit.DoctypeReader; > import org.custommonkey.xmlunit.Validator; > import org.custommonkey.xmlunit.XMLAssert; > import org.xml.sax.SAXException; > > /** > * First written at : May 5, 2003 11:45:25 AM > * Project : unimoney > * Package : it.unimaticaspa.unimoney.utils > * File : MyXMLAssert.java > * Type : MyXMLAssert > * @author ldallolio Luca Dall'Olio lda...@un... > * > * To change the template for this generated type comment go to > * Window>Preferences>Java>Code Generation>Code and Comments > */ > public class MyXMLAssert { > > /** > * > */ > protected MyXMLAssert() { > super(); > // TODO Auto-generated constructor stub > } > > /** > * Assert that a String containing XML contains valid XML: the String will > * be given a DOCTYPE to be validated with the name and systemId specified > * regardless of whether it already contains a doctype declaration. > * @param xmlString > * @param systemId > * @param doctype > * @throws SAXException > * @throws ParserConfigurationException > * @see Validator > */ > public static void assertXMLValid(String xmlString, String systemId, String doctype) > throws SAXException, ParserConfigurationException { > DoctypeReader schemaReader = > new SchemaReader( > new StringReader(xmlString), > doctype, > systemId); > Validator myValidator = new Validator(schemaReader); > myValidator.useXMLSchema(true); > XMLAssert.assertXMLValid(myValidator); > } > } |
From: Luca Dall'O. <lda...@un...> - 2003-05-08 06:58:00
|
I have really appreciated your enhancement to the Validator class including the useXMLSchema() method; now I can validate my xml using xsd schema. Still, I couldn't find out how to redirect the retrival of xsd files : they are always supposed to be in the project home directory (or the ant home, depending on the build tool I use). After some code digging I suppose that the current way to redirect files works only for DTDs, so I tried to extend it for xsd too. I have not written a clean solution but it seems to work, so I thought better to post it : perhaps it could be useful for others too. My solution is based on an extension of the DoctypeReader class (this way I can pass it to the Validator constructor) that parses the input, adds a couple of attributes to the root element with the xsd info and serializes it back to a string... very similar to the doctypeReader itself. I have written a simple helper class to use the assertXMLValid() interface, it can be useful as an example of the calling. This is the way I call it : private String xsdName = "ordinativoFirmato.xsd"; private String xsdPath = this.getClass().getResource(xsdName).toString(); ... MyXMLAssert.assertXMLValid(supposedNormalizedString, xsdName, xsdPath); I think that a much cleaner way to solve this problem would be to make use of oasis catalogs : http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=entity An implementation can be downloaded at the apache site in the xml commons package, and IMVHO it should be rather straightforward to add it to xmlunit: http://xml.apache.org/commons/ If you are interested I can have a look at it, just let me know! greetings, Luca Dall'Olio (dal...@un...) |
From: Jeff M. <je...@mk...> - 2003-02-11 10:18:53
|
Just out of interest why would you want to do that? We should probably add this method to XMLUnit as well to allow tests to be performed against an XSD. Is there a way to assert that a document has a reference to a DTD or XSD? On Mon, 2003-02-10 at 20:48, Tim Bacon wrote: > FYI The original intent of the validator class was to allow validation > against DTD 'A' to be performed when the XML content refers to DTD 'B'. > > Thanks for the feedback, > > Tim > > Jeff Martin wrote: > > >Cool, I was just adding this method to the validator ;-) > > > >public void useXMLSchema(boolean use) throws SAXException { > > parser.getXMLReader().setFeature( > > "http://xml.org/sax/features/validation",!use); > > parser.getXMLReader().setFeature( > > "http://apache.org/xml/features/validation/schema",use); > > parser.getXMLReader().setFeature( > > "http://apache.org/xml/features/validation/dynamic", use); > >} > > > >Thanks, for the feedback. Hope you hit a green bar soon. > > > > > > > >On Fri, 2003-02-07 at 11:08, Bonnet Emmanuel wrote: > > > > > >>I think I found it : > >>The features necessary for the SAX parser are not added in the case of XSD validation. > >>Here is the code I changed in the Validator Class to make it work. > >>I still have a problem later with the assertXMLEquals. > >>But now XmlUnit validates my files with XSD. > >> > >>____________________________________________________________ > >> /** > >> * Baseline constructor: called by all others > >> * @param inputSource > >> * @param usingDoctypeReader > >> * @throws ParserConfigurationException > >> * @throws SAXException > >> */ > >> protected Validator(InputSource inputSource, boolean usingDoctypeReader) > >> throws ParserConfigurationException, SAXException { > >> isValid = null; > >> messages = new StringBuffer(); > >> SAXParserFactory factory = XMLUnit.getSAXParserFactory(); > >> factory.setValidating(true); > >> parser = factory.newSAXParser(); > >> this.validationInputSource = inputSource; > >> this.usingDoctypeReader = usingDoctypeReader; > >> > >> //---- EB modification > >> parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", true); > >> parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", ! usingDoctypeReader); > >> parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/dynamic", true); > >> > >> } > >>_________________________________________________________________________ > >> > >> > >>Hope this helps, > >>Emmanuel > >> > >> > >> > >> > >> > >>------------------------------------------------------- > >>This SF.NET email is sponsored by: > >>SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > >>http://www.vasoftware.com > >>_______________________________________________ > >>Xmlunit-general mailing list > >>Xml...@li... > >>https://lists.sourceforge.net/lists/listinfo/xmlunit-general > >> > >> > > > __________________________________________________ > Do You Yahoo!? > Everything you'll ever need on one web page > from News and Sport to Email and Music Charts > http://uk.my.yahoo.com > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- Jeff Martin <je...@mk...> |
From: Tim B. <t_j...@ya...> - 2003-02-10 20:46:00
|
FYI The original intent of the validator class was to allow validation against DTD 'A' to be performed when the XML content refers to DTD 'B'. Thanks for the feedback, Tim Jeff Martin wrote: >Cool, I was just adding this method to the validator ;-) > >public void useXMLSchema(boolean use) throws SAXException { > parser.getXMLReader().setFeature( > "http://xml.org/sax/features/validation",!use); > parser.getXMLReader().setFeature( > "http://apache.org/xml/features/validation/schema",use); > parser.getXMLReader().setFeature( > "http://apache.org/xml/features/validation/dynamic", use); >} > >Thanks, for the feedback. Hope you hit a green bar soon. > > > >On Fri, 2003-02-07 at 11:08, Bonnet Emmanuel wrote: > > >>I think I found it : >>The features necessary for the SAX parser are not added in the case of XSD validation. >>Here is the code I changed in the Validator Class to make it work. >>I still have a problem later with the assertXMLEquals. >>But now XmlUnit validates my files with XSD. >> >>____________________________________________________________ >> /** >> * Baseline constructor: called by all others >> * @param inputSource >> * @param usingDoctypeReader >> * @throws ParserConfigurationException >> * @throws SAXException >> */ >> protected Validator(InputSource inputSource, boolean usingDoctypeReader) >> throws ParserConfigurationException, SAXException { >> isValid = null; >> messages = new StringBuffer(); >> SAXParserFactory factory = XMLUnit.getSAXParserFactory(); >> factory.setValidating(true); >> parser = factory.newSAXParser(); >> this.validationInputSource = inputSource; >> this.usingDoctypeReader = usingDoctypeReader; >> >> //---- EB modification >> parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", true); >> parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", ! usingDoctypeReader); >> parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/dynamic", true); >> >> } >>_________________________________________________________________________ >> >> >>Hope this helps, >>Emmanuel >> >> >> >> >> >>------------------------------------------------------- >>This SF.NET email is sponsored by: >>SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! >>http://www.vasoftware.com >>_______________________________________________ >>Xmlunit-general mailing list >>Xml...@li... >>https://lists.sourceforge.net/lists/listinfo/xmlunit-general >> >> __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com |
From: Jeff M. <je...@mk...> - 2003-02-07 11:48:06
|
Cool, I was just adding this method to the validator ;-) public void useXMLSchema(boolean use) throws SAXException { parser.getXMLReader().setFeature( "http://xml.org/sax/features/validation",!use); parser.getXMLReader().setFeature( "http://apache.org/xml/features/validation/schema",use); parser.getXMLReader().setFeature( "http://apache.org/xml/features/validation/dynamic", use); } Thanks, for the feedback. Hope you hit a green bar soon. On Fri, 2003-02-07 at 11:08, Bonnet Emmanuel wrote: > I think I found it : > The features necessary for the SAX parser are not added in the case of XSD validation. > Here is the code I changed in the Validator Class to make it work. > I still have a problem later with the assertXMLEquals. > But now XmlUnit validates my files with XSD. > > ____________________________________________________________ > /** > * Baseline constructor: called by all others > * @param inputSource > * @param usingDoctypeReader > * @throws ParserConfigurationException > * @throws SAXException > */ > protected Validator(InputSource inputSource, boolean usingDoctypeReader) > throws ParserConfigurationException, SAXException { > isValid = null; > messages = new StringBuffer(); > SAXParserFactory factory = XMLUnit.getSAXParserFactory(); > factory.setValidating(true); > parser = factory.newSAXParser(); > this.validationInputSource = inputSource; > this.usingDoctypeReader = usingDoctypeReader; > > //---- EB modification > parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", true); > parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", ! usingDoctypeReader); > parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/dynamic", true); > > } > _________________________________________________________________________ > > > Hope this helps, > Emmanuel > > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- Jeff Martin <je...@mk...> |
From: Jeff M. <je...@mk...> - 2003-02-07 11:12:45
|
Cheers, still not got the the bottom of this. But, have couple of points to note. j2sdk1.4.1 uses crimson as it's parser not xerces. This means you need to call XMLUnit.setSAXParserFactory("org.apache.xerces.jaxp.SAXParserFactoryImpl"= ); Another point which may help (need to look at this cause it's a bit naf at the moment) it that error messages from parsing the can only be displayed by calling toString on the Validator. So you probably need to write tests like this. String generated=3D"BookXsdGenerated.xml"; Validator validator =3D new Validator(new FileReader(generated)); if(!validator.isValid()){ fail(validator.toString()); } This then gives you details of the failure (Might add a assertValid() met= hod in the future). At the moment when I try this I get the following message which to me sug= gests that it's trying to validate against a dtd not the XML Schema. Document is invalid: no grammar found. Document root element "Book", must= match DOCTYPE root "null".=20 I'll keep digging about and see if I get anywhere. On Thu, 2003-02-06 at 17:40, Bonnet Emmanuel wrote: > Attached are the files I am using : > I guess you will have to change the access path for the schema location. >=20 > The message is "Document is invalid: no grammar found". >=20 > My code is : > String generated=3D"BookXsdGenerated.xml"; > Validator validator =3D new Validator(new FileReader(generated)); > this.assertTrue(validator.isValid()); >=20 > the pb occurs on the validator.isValid > -> parser triggers an exception. >=20 > I am wondering if it is not an access pb. > The SAME code is working properly with other > xml files with the same structure but which are > using a dtd validation. >=20 > Emmanuel >=20 >=20 > Jeff Martin a =C3=A9crit : >=20 > > I've never used XSD so I'm not sure what should happen, but the > > validator calls the parse method on the xml parser. Xerces2 is suppos= ed > > to support XSD validation and I assume that you just need to have a > > resolvable xmlns attribute in the root element and it should barf whe= n > > you try an parse the file. > > > > Can you give us an example? > > > > On Thu, 2003-02-06 at 16:36, Bonnet Emmanuel wrote: > > > Hi All, > > > I have trouble using the XmlUnit Validator with a > > > Xml file that must be validated with a XSD. > > > I use the following code > > > > > > Validator validator =3D new Validator(new FileReader(file)); > > > this.assertTrue(validator.isValid()); > > > > > > > > > And file contains the full reference to its XSD. > > > Do you have any idea about that ? > > > > > > Regards, > > > Emmanuel > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.NET email is sponsored by: > > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 S= ee! > > > http://www.vasoftware.com > > > _______________________________________________ > > > Xmlunit-general mailing list > > > Xml...@li... > > > https://lists.sourceforge.net/lists/listinfo/xmlunit-general > > -- > > Jeff Martin <je...@mk...> > > > > ------------------------------------------------------- > > This SF.NET email is sponsored by: > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See= ! > > http://www.vasoftware.com > > _______________________________________________ > > Xmlunit-general mailing list > > Xml...@li... > > https://lists.sourceforge.net/lists/listinfo/xmlunit-general >=20 > -- >=20 > ------------------------------------------------------------------- > Emmanuel BONNET Mail : eb...@ge... > GENIGRAPH URL : http://www.genigraph.fr > Tertial II > 216, Route de St Simon Tel : +33 (0)5.34.60.92.84 > 31100 TOULOUSE - FRANCE Fax : +33 (0)5.34.60.92.89 > ------------------------------------------------------------------- >=20 >=20 > ______________________________________________________________________ >=20 > <?xml version=3D"1.0" encoding=3D"UTF-8"?> > <Book xmlns:xsd=3D"http://www.w3.org/2000/10/XMLSchema" xmlns=3D"http:/= /www.publishing.org" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instan= ce" xsi:schemaLocation=3D"http://www.publishing.org Book.xsd"> > <Title>Chicken Soup for the Soul</Title> > <Author>Jack Canfield</Author> > <Author>Mark Victor Hansen</Author> > <Date>1993</Date> > <ISBN>1-55874-262-X</ISBN> > <Publisher>Health Communications, Inc.</Publisher> > </Book> >=20 > ______________________________________________________________________ >=20 > <?xml version=3D"1.0"?> > <xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" > targetNamespace=3D"http://www.publishing.org" > xmlns=3D"http://www.publishing.org" > version=3D"1.0" > elementFormDefault=3D"qualified"> > =09 > <xsd:element name=3D"Book" type=3D"BookType"/> >=20 > <xsd:complexType name=3D"BookType"> > <xsd:sequence> > <xsd:element name=3D"Title" type=3D"xsd:string" minOccurs=3D= "1" maxOccurs=3D"1"/> > <xsd:element name=3D"Author" type=3D"xsd:string" minOccurs=3D= "1" maxOccurs=3D"unbounded"/> > <xsd:element name=3D"Date" type=3D"xsd:string" minOccurs=3D= "1" maxOccurs=3D"1"/> > <xsd:element name=3D"ISBN" type=3D"xsd:string" minOccurs=3D= "1" maxOccurs=3D"1"/> > <xsd:element name=3D"Publisher" type=3D"xsd:string" minOccu= rs=3D"1" maxOccurs=3D"1"/> > </xsd:sequence> > </xsd:complexType> > </xsd:schema> --=20 Jeff Martin <je...@mk...> |
From: Bonnet E. <eb...@ge...> - 2003-02-07 11:12:02
|
I think I found it : The features necessary for the SAX parser are not added in the case of XSD validation. Here is the code I changed in the Validator Class to make it work. I still have a problem later with the assertXMLEquals. But now XmlUnit validates my files with XSD. ____________________________________________________________ /** * Baseline constructor: called by all others * @param inputSource * @param usingDoctypeReader * @throws ParserConfigurationException * @throws SAXException */ protected Validator(InputSource inputSource, boolean usingDoctypeReader) throws ParserConfigurationException, SAXException { isValid = null; messages = new StringBuffer(); SAXParserFactory factory = XMLUnit.getSAXParserFactory(); factory.setValidating(true); parser = factory.newSAXParser(); this.validationInputSource = inputSource; this.usingDoctypeReader = usingDoctypeReader; //---- EB modification parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", true); parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", ! usingDoctypeReader); parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/dynamic", true); } _________________________________________________________________________ Hope this helps, Emmanuel |
From: Bonnet E. <eb...@ge...> - 2003-02-06 17:44:28
|
Attached are the files I am using : I guess you will have to change the access path for the schema location. The message is "Document is invalid: no grammar found". My code is : String generated=3D"BookXsdGenerated.xml"; Validator validator =3D new Validator(new FileReader(generated)); this.assertTrue(validator.isValid()); the pb occurs on the validator.isValid -> parser triggers an exception. I am wondering if it is not an access pb. The SAME code is working properly with other xml files with the same structure but which are using a dtd validation. Emmanuel Jeff Martin a =E9crit : > I've never used XSD so I'm not sure what should happen, but the > validator calls the parse method on the xml parser. Xerces2 is supposed > to support XSD validation and I assume that you just need to have a > resolvable xmlns attribute in the root element and it should barf when > you try an parse the file. > > Can you give us an example? > > On Thu, 2003-02-06 at 16:36, Bonnet Emmanuel wrote: > > Hi All, > > I have trouble using the XmlUnit Validator with a > > Xml file that must be validated with a XSD. > > I use the following code > > > > Validator validator =3D new Validator(new FileReader(file)); > > this.assertTrue(validator.isValid()); > > > > > > And file contains the full reference to its XSD. > > Do you have any idea about that ? > > > > Regards, > > Emmanuel > > > > > > > > > > ------------------------------------------------------- > > This SF.NET email is sponsored by: > > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See= ! > > http://www.vasoftware.com > > _______________________________________________ > > Xmlunit-general mailing list > > Xml...@li... > > https://lists.sourceforge.net/lists/listinfo/xmlunit-general > -- > Jeff Martin <je...@mk...> > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- ------------------------------------------------------------------- Emmanuel BONNET Mail : eb...@ge... GENIGRAPH URL : http://www.genigraph.fr Tertial II 216, Route de St Simon Tel : +33 (0)5.34.60.92.84 31100 TOULOUSE - FRANCE Fax : +33 (0)5.34.60.92.89 ------------------------------------------------------------------- |
From: Jeff M. <je...@mk...> - 2003-02-06 17:14:08
|
I've never used XSD so I'm not sure what should happen, but the validator calls the parse method on the xml parser. Xerces2 is supposed to support XSD validation and I assume that you just need to have a resolvable xmlns attribute in the root element and it should barf when you try an parse the file. Can you give us an example? On Thu, 2003-02-06 at 16:36, Bonnet Emmanuel wrote: > Hi All, > I have trouble using the XmlUnit Validator with a > Xml file that must be validated with a XSD. > I use the following code > > Validator validator = new Validator(new FileReader(file)); > this.assertTrue(validator.isValid()); > > > And file contains the full reference to its XSD. > Do you have any idea about that ? > > Regards, > Emmanuel > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- Jeff Martin <je...@mk...> |
From: Bonnet E. <eb...@ge...> - 2003-02-06 16:40:06
|
Hi All, I have trouble using the XmlUnit Validator with a Xml file that must be validated with a XSD. I use the following code Validator validator = new Validator(new FileReader(file)); this.assertTrue(validator.isValid()); And file contains the full reference to its XSD. Do you have any idea about that ? Regards, Emmanuel |
From: <je...@mk...> - 2003-01-13 10:13:08
|
I beleive you should be able to do this with XMLUnit.getTestParser().setEntityResolver(new EntityResolver(){ public InputSource resolveEntity (String publicId, String systemId){ ... resolve resolve you're entity here } }); http://java.sun.com/j2se/1.4.1/docs/api/org/xml/sax/EntityResolver.html Never tried it myself though, let me know how you get on. ;) Quoting Ralf Wirdemann <rwi...@t-...>: > Hi, > > thanks for XML-Unit. It looks like exactly the tool we need for > verifying that our UML2EJB generator generates the same XML results > after we've changed the generator. > > I got one question: My XML file contains the following line at the top > of the document: <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" > "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">. The problem is, that > this file doesn't exist and there is no way for me to change the > generator the produce a correct http-link. Therefore my question is: Is > it possible to prevent XMLUnit from following http-links given in the > XML-tag <!DOCTYPE>? > > Thanks, > Ralf > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general > |
From: <rwi...@t-...> - 2003-01-12 11:03:08
|
Hi, thanks for XML-Unit. It looks like exactly the tool we need for verifying that our UML2EJB generator generates the same XML results after we've changed the generator. I got one question: My XML file contains the following line at the top of the document: <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">. The problem is, that this file doesn't exist and there is no way for me to change the generator the produce a correct http-link. Therefore my question is: Is it possible to prevent XMLUnit from following http-links given in the XML-tag <!DOCTYPE>? Thanks, Ralf |
From: Jeff M. <je...@mk...> - 2002-08-30 08:14:52
|
Looks like a crimson problem. Not sure that crimson supports some of the newer DOM features. Have you tried xerces 1.4.4 On Thu, 2002-08-29 at 19:44, Erwin Chan wrote: > Hi, I hope someone can help me. I keep getting this error when I try to do > an assertXMLEqual. > > java.lang.NoSuchMethodError > at > org.apache.crimson.tree.AttributeSet.createAttributeSet2(AttributeSet.java:174) > at > org.apache.crimson.tree.XmlDocumentBuilderNS.startElement(XmlDocumentBuilderNS.java:90) > at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1488) > at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) > at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) > at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) > at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) > at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) > at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) > at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500) > at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) > at > org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) > at > org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185) > at org.custommonkey.xmlunit.XMLUnit.buildDocument(Unknown Source) > at org.custommonkey.xmlunit.Diff.<init>(Unknown Source) > at org.custommonkey.xmlunit.Diff.<init>(Unknown Source) > at org.custommonkey.xmlunit.XMLTestCase.compareXML(Unknown Source) > at org.custommonkey.xmlunit.XMLTestCase.assertXMLEqual(Unknown Source) > at > com.ams.acquiline.junittest.vendortest.VendorQueryTest.testVendorQuery(VendorQueryTest.java:85) > > Any ideas? Thanks a lot! > > -Erwin > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |
From: Erwin C. <erw...@am...> - 2002-08-29 18:46:56
|
Hi, I hope someone can help me. I keep getting this error when I try to do an assertXMLEqual. java.lang.NoSuchMethodError at org.apache.crimson.tree.AttributeSet.createAttributeSet2(AttributeSet.java:174) at org.apache.crimson.tree.XmlDocumentBuilderNS.startElement(XmlDocumentBuilderNS.java:90) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1488) at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) at org.apache.crimson.parser.Parser2.content(Parser2.java:1779) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500) at org.apache.crimson.parser.Parser2.parse(Parser2.java:305) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442) at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185) at org.custommonkey.xmlunit.XMLUnit.buildDocument(Unknown Source) at org.custommonkey.xmlunit.Diff.<init>(Unknown Source) at org.custommonkey.xmlunit.Diff.<init>(Unknown Source) at org.custommonkey.xmlunit.XMLTestCase.compareXML(Unknown Source) at org.custommonkey.xmlunit.XMLTestCase.assertXMLEqual(Unknown Source) at com.ams.acquiline.junittest.vendortest.VendorQueryTest.testVendorQuery(VendorQueryTest.java:85) Any ideas? Thanks a lot! -Erwin |
From: <t_j...@ya...> - 2002-05-21 08:27:27
|
There is currently no facility to do this, as the intent of the Diff class was to enable assertions about the equality (or not) of two 'pieces' of XML. And once the first difference is found then the assertion has been disproved (or proved). In theory it should be possible to list all the differences, but how would you want to expose this functionality within an assertion? E.g. - assertNumberOfDifferencesLessThan(control, test, 2) - assertDifferencesNotIncludes(control, test, A_DIFFERENCE_CONSTANT)? Knowing the intended use is the first step to making the API appropriate. Rgds, Tim __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com |
From: Sumit S. <su...@ho...> - 2002-05-21 00:36:51
|
XMLUnit.compare() or Diff() is returning only the first difference. All the other differences are ignored. How can I get all the differences between control and test document? Here is the sample code I am using: ============================= import org.custommonkey.xmlunit.Diff; import java.io.FileReader; public class test_Diff { public static String testFiles (String controlFile, String testFile) { FileReader control = null; FileReader test = null; Diff diff = null; try{ control = new FileReader(controlFile); test = new FileReader(testFile); } catch ( Exception ioe) { System.out.println("File read problem"); }; try { //diff = XMLUnit.compare(control, test); diff = new Diff(control, test); } catch (Exception e) { System.out.println("Expection : " + e.toString()); }; return (diff.toString()); } public static void main(String[] args) { String controlFile = args[0]; String testFile = args[1]; System.out.println(testFiles(controlFile, testFile)); _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |