Constructor and Description |
---|
XmlConfig()
Create a new instance of XmlConfig without any features and that is namespace unaware.
|
Modifier and Type | Method and Description |
---|---|
XmlConfig |
allowDocTypeDeclaration(boolean allowDocTypeDeclaration)
Configure if XmlPath should provide support for DOCTYPE declarations (default is ).
|
XmlConfig |
and()
For syntactic sugar.
|
Map<String,String> |
declaredNamespaces() |
XmlConfig |
declareNamespace(String prefix,
String namespaceURI)
Declares a namespace and also sets
namespaceAware(boolean) to true . |
XmlConfig |
declareNamespaces(Map<String,String> namespacesToDeclare)
Specify declared namespaces that will be used when parsing XML.
|
XmlConfig |
disableLoadingOfExternalDtd()
Disables external DTD loading.
|
XmlConfig |
feature(String uri,
boolean enabled)
Set a value of a feature flag.
|
Map<String,Boolean> |
features() |
XmlConfig |
features(Map<String,Boolean> features)
Specify features that will be used when parsing XML.
|
boolean |
isAllowDocTypeDeclaration()
Whether XmlPath should provide support for DOCTYPE declarations
|
boolean |
isNamespaceAware() |
boolean |
isUserConfigured() |
boolean |
isValidating()
Whether XmlPath should validate documents as they are parsed.
|
XmlConfig |
namespaceAware(boolean shouldBeAwareOfNamespaces)
Configure whether or not REST Assured should be aware of namespaces when parsing XML (default is ).
|
Map<String,Object> |
properties() |
XmlConfig |
properties(Map<String,Object> properties)
Specify properties that will be used when parsing XML.
|
XmlConfig |
property(String name,
Object value)
Set a value of a property.
|
XmlConfig |
validating(boolean isValidating)
Configure if XmlPath should validate documents as they are parsed (default is ).
|
XmlConfig |
with()
For syntactic sugar.
|
static XmlConfig |
xmlConfig() |
public XmlConfig()
public Map<String,Boolean> features()
XmlSlurper
.XMLReader.setFeature(java.lang.String, boolean)
public Map<String,Object> properties()
XmlSlurper
.XMLReader.setProperty(String, Object)
public XmlConfig features(Map<String,Boolean> features)
features
- A map containing features that will be used by the underlying XmlSlurper
.XMLReader.setFeature(java.lang.String, boolean)
public XmlConfig properties(Map<String,Object> properties)
properties
- A map containing properties that will be used by the underlying XmlSlurper
.XMLReader.setProperty(String, Object)
public XmlConfig feature(String uri, boolean enabled)
uri
- The feature name, which is a fully-qualified URI.enabled
- The requested value of the feature (true or false).XMLReader.setFeature(java.lang.String, boolean)
public XmlConfig property(String name, Object value)
name
- The property name.value
- The requested value of the feature (true or false).XMLReader.setFeature(java.lang.String, boolean)
public Map<String,String> declaredNamespaces()
XmlSlurper
.XMLReader.setFeature(java.lang.String, boolean)
public XmlConfig declareNamespaces(Map<String,String> namespacesToDeclare)
namespaceAware(boolean)
to true
of namespaces are not empty.
Note that you cannot use this to add namespaces for the org.hamcrest.xml.HasXPath
matcher.
This has to be done by providing a NamespaceContext
to the matcher instance.
namespacesToDeclare
- A map containing features that will be used by the underlying XmlSlurper
.XMLReader.setFeature(java.lang.String, boolean)
public XmlConfig declareNamespace(String prefix, String namespaceURI)
namespaceAware(boolean)
to true
.
Note that you cannot use this to add namespaces for the org.hamcrest.xml.HasXPath
matcher.
This has to be done by providing a NamespaceContext
to the matcher instance.
prefix
- The feature name, which is a fully-qualified URI.namespaceURI
- The requested value of the feature (true or false).XMLReader.setFeature(java.lang.String, boolean)
public XmlConfig disableLoadingOfExternalDtd()
This is a shortcut for doing:
setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
feature(String, boolean)
public XmlConfig validating(boolean isValidating)
XmlPath.CompatibilityMode
is equal to
XmlPath.CompatibilityMode#XML
.isValidating
- true
if the parser should validate documents as they are parsed; false
otherwise.public boolean isValidating()
public XmlConfig namespaceAware(boolean shouldBeAwareOfNamespaces)
XmlPath.CompatibilityMode
is equal to
XmlPath.CompatibilityMode#XML
.shouldBeAwareOfNamespaces
- true
if xml parsing should take namespaces into account.public boolean isNamespaceAware()
true
if REST Assured should be namespace aware.public XmlConfig allowDocTypeDeclaration(boolean allowDocTypeDeclaration)
XmlPath.CompatibilityMode
is equal to
XmlPath.CompatibilityMode#XML
.allowDocTypeDeclaration
- true
if the parser should provide support for DOCTYPE declarations; false
otherwise.public boolean isAllowDocTypeDeclaration()
public XmlConfig with()
public XmlConfig and()
public static XmlConfig xmlConfig()
public boolean isUserConfigured()
isUserConfigured
in interface Config
true
if this config instance has been explicitly configured by the user, false
if it has the default values.Copyright © 2010–2019. All rights reserved.