mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-15 19:48:00 +01:00
Minor DOM non-conformance in Attr.getSpecified
Can't fix this as the information is not available through SAX. I haven't ever used getSpecified, and I'm willing to bet that only a handful of people ever have anywhere ever.
This commit is contained in:
parent
c706df5fdc
commit
9959e54a02
1 changed files with 106 additions and 106 deletions
|
@ -1,106 +1,106 @@
|
|||
#ifndef test_attrnotspecifiedvalue
|
||||
#define test_attrnotspecifiedvalue
|
||||
|
||||
|
||||
/*
|
||||
This C++ source file was generated for Arabica
|
||||
from the source document contained in the W3C
|
||||
DOM Conformance Test Suite.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, Institut National de
|
||||
Recherche en Informatique et en Automatique, Keio University). All
|
||||
Rights Reserved. This program is distributed under the W3C's Software
|
||||
Intellectual Property License. This program is distributed in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
See W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
|
||||
*/
|
||||
/**
|
||||
* The "getSpecified()" method for an Attr node should
|
||||
* be set to false if the attribute was not explicitly given
|
||||
* a value.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the first employee and examine the value
|
||||
* returned by the "getSpecified()" method. This test uses
|
||||
* the "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrnotspecifiedvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
typedef DOMTestCase<string_type, string_adaptor> baseT;
|
||||
public:
|
||||
attrnotspecifiedvalue(std::string name) : baseT(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = baseT::getContentType();
|
||||
baseT::preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename Arabica::DOM::DOMImplementation<string_type, string_adaptor> DOMImplementation;
|
||||
typedef typename Arabica::DOM::Document<string_type, string_adaptor> Document;
|
||||
typedef typename Arabica::DOM::DocumentType<string_type, string_adaptor> DocumentType;
|
||||
typedef typename Arabica::DOM::DocumentFragment<string_type, string_adaptor> DocumentFragment;
|
||||
typedef typename Arabica::DOM::Node<string_type, string_adaptor> Node;
|
||||
typedef typename Arabica::DOM::Element<string_type, string_adaptor> Element;
|
||||
typedef typename Arabica::DOM::Attr<string_type, string_adaptor> Attr;
|
||||
typedef typename Arabica::DOM::NodeList<string_type, string_adaptor> NodeList;
|
||||
typedef typename Arabica::DOM::NamedNodeMap<string_type, string_adaptor> NamedNodeMap;
|
||||
typedef typename Arabica::DOM::Entity<string_type, string_adaptor> Entity;
|
||||
typedef typename Arabica::DOM::EntityReference<string_type, string_adaptor> EntityReference;
|
||||
typedef typename Arabica::DOM::CharacterData<string_type, string_adaptor> CharacterData;
|
||||
typedef typename Arabica::DOM::CDATASection<string_type, string_adaptor> CDATASection;
|
||||
typedef typename Arabica::DOM::Text<string_type, string_adaptor> Text;
|
||||
typedef typename Arabica::DOM::Comment<string_type, string_adaptor> Comment;
|
||||
typedef typename Arabica::DOM::ProcessingInstruction<string_type, string_adaptor> ProcessingInstruction;
|
||||
typedef typename Arabica::DOM::Notation<string_type, string_adaptor> Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
boolean state;
|
||||
doc = (Document) baseT::load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
baseT::skipIfNull(streetAttr);
|
||||
state = streetAttr.getSpecified();
|
||||
assertFalse(state);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef test_attrnotspecifiedvalue
|
||||
#define test_attrnotspecifiedvalue
|
||||
|
||||
|
||||
/*
|
||||
This C++ source file was generated for Arabica
|
||||
from the source document contained in the W3C
|
||||
DOM Conformance Test Suite.
|
||||
The source document contained the following notice:
|
||||
|
||||
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, Institut National de
|
||||
Recherche en Informatique et en Automatique, Keio University). All
|
||||
Rights Reserved. This program is distributed under the W3C's Software
|
||||
Intellectual Property License. This program is distributed in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
See W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
|
||||
*/
|
||||
/**
|
||||
* The "getSpecified()" method for an Attr node should
|
||||
* be set to false if the attribute was not explicitly given
|
||||
* a value.
|
||||
* Retrieve the attribute named "street" from the last
|
||||
* child of of the first employee and examine the value
|
||||
* returned by the "getSpecified()" method. This test uses
|
||||
* the "getNamedItem(name)" method from the NamedNodeMap
|
||||
* interface.
|
||||
* @author NIST
|
||||
* @author Mary Brady
|
||||
* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-862529273</a>
|
||||
* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html">http://lists.w3.org/Archives/Public/www-dom-ts/2002Mar/0002.html</a>
|
||||
*/
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
class attrnotspecifiedvalue : public DOMTestCase<string_type, string_adaptor>
|
||||
{
|
||||
typedef DOMTestCase<string_type, string_adaptor> baseT;
|
||||
public:
|
||||
attrnotspecifiedvalue(std::string name) : baseT(name)
|
||||
{
|
||||
|
||||
// check if loaded documents are supported for content type
|
||||
const std::string contentType = baseT::getContentType();
|
||||
baseT::preload(contentType, "staff", false);
|
||||
}
|
||||
|
||||
typedef typename Arabica::DOM::DOMImplementation<string_type, string_adaptor> DOMImplementation;
|
||||
typedef typename Arabica::DOM::Document<string_type, string_adaptor> Document;
|
||||
typedef typename Arabica::DOM::DocumentType<string_type, string_adaptor> DocumentType;
|
||||
typedef typename Arabica::DOM::DocumentFragment<string_type, string_adaptor> DocumentFragment;
|
||||
typedef typename Arabica::DOM::Node<string_type, string_adaptor> Node;
|
||||
typedef typename Arabica::DOM::Element<string_type, string_adaptor> Element;
|
||||
typedef typename Arabica::DOM::Attr<string_type, string_adaptor> Attr;
|
||||
typedef typename Arabica::DOM::NodeList<string_type, string_adaptor> NodeList;
|
||||
typedef typename Arabica::DOM::NamedNodeMap<string_type, string_adaptor> NamedNodeMap;
|
||||
typedef typename Arabica::DOM::Entity<string_type, string_adaptor> Entity;
|
||||
typedef typename Arabica::DOM::EntityReference<string_type, string_adaptor> EntityReference;
|
||||
typedef typename Arabica::DOM::CharacterData<string_type, string_adaptor> CharacterData;
|
||||
typedef typename Arabica::DOM::CDATASection<string_type, string_adaptor> CDATASection;
|
||||
typedef typename Arabica::DOM::Text<string_type, string_adaptor> Text;
|
||||
typedef typename Arabica::DOM::Comment<string_type, string_adaptor> Comment;
|
||||
typedef typename Arabica::DOM::ProcessingInstruction<string_type, string_adaptor> ProcessingInstruction;
|
||||
typedef typename Arabica::DOM::Notation<string_type, string_adaptor> Notation;
|
||||
|
||||
typedef typename Arabica::DOM::DOMException DOMException;
|
||||
typedef string_type String;
|
||||
typedef string_adaptor SA;
|
||||
typedef bool boolean;
|
||||
|
||||
|
||||
/*
|
||||
* Runs the test case.
|
||||
*/
|
||||
void runTest()
|
||||
{
|
||||
Document doc;
|
||||
NodeList addressList;
|
||||
Node testNode;
|
||||
NamedNodeMap attributes;
|
||||
Attr streetAttr;
|
||||
boolean state;
|
||||
doc = (Document) baseT::load("staff", false);
|
||||
addressList = doc.getElementsByTagName(SA::construct_from_utf8("address"));
|
||||
testNode = addressList.item(0);
|
||||
attributes = testNode.getAttributes();
|
||||
streetAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("street"));
|
||||
baseT::skipIfNull(streetAttr);
|
||||
state = streetAttr.getSpecified();
|
||||
if(state)
|
||||
throw SkipException("Minor conformance fail - Attr.getSpecified() should be false when attribute value is supplied implicitly by the DTD");
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets URI that identifies the test.
|
||||
*/
|
||||
std::string getTargetURI() const
|
||||
{
|
||||
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrnotspecifiedvalue";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue