- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.deegree.commons.xml.stax.XMLStreamReaderWrapper
类的一些代码示例,展示了XMLStreamReaderWrapper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamReaderWrapper
类的具体详情如下:
包路径:org.deegree.commons.xml.stax.XMLStreamReaderWrapper
类名称:XMLStreamReaderWrapper
[英]TODO add documentation here
[中]TODO在此处添加文档
代码示例来源:origin: deegree/deegree3
@Override
public XMLStreamReaderWrapper work( InputStream in )
throws IOException {
try {
return new XMLStreamReaderWrapper( XmlHttpUtils.xmlInputFactory.createXMLStreamReader( in ),
"Post response" );
} catch ( XMLStreamException e ) {
throw new IOException( "Error creating XMLStreamReader for POST response: " + e.getMessage() );
}
}
};
代码示例来源:origin: deegree/deegree3
private Geometry parseGeometryProperty( XMLStreamReaderWrapper xmlStream, ICRS crs )
throws XMLStreamException {
Geometry geometry = null;
String href = xmlStream.getAttributeValue( CommonNamespaces.XLNNS, "href" );
if ( href != null && href.length() > 0 ) {
LOG.debug( "Found geometry reference (xlink): '" + href + "'" );
geometry = new GeometryReference<Geometry>( idContext, href, xmlStream.getSystemId() );
idContext.addReference( (GeometryReference<?>) geometry );
if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
String msg = "Unexpected element '" + xmlStream.getName()
+ "'. Geometry value has already been specified using xlink.";
throw new XMLParsingException( xmlStream, msg );
}
} else if ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
geometry = parse( xmlStream, crs );
xmlStream.nextTag();
} else {
String msg = "Error in geometry property element. Expected a 'gml:_Geometry' element or an 'xlink:href' attribute.";
throw new XMLParsingException( xmlStream, msg );
}
return geometry;
}
代码示例来源:origin: deegree/deegree3
@Override
public void require( int type, String namespaceURI, String localName )
throws XMLStreamException {
if ( getEventType() != type ) {
String msg = "Expected event type " + type + ", but found " + getCurrentEventInfo();
throw new XMLParsingException( this, msg );
}
if ( type == START_ELEMENT || type == END_ELEMENT ) {
if ( !getName().equals( new QName( namespaceURI, localName ) ) ) {
String msg = "Expected {" + namespaceURI + "}" + localName + ", but found: " + getCurrentEventInfo();
throw new XMLParsingException( this, msg );
}
}
}
代码示例来源:origin: deegree/deegree3
public int getElementTextAsPositiveInteger( String namespaceURI, String localName )
throws XMLParsingException, XMLStreamException {
require( START_ELEMENT, namespaceURI, localName );
return getElementTextAsPositiveInteger();
}
代码示例来源:origin: deegree/deegree3
public double getElementTextAsDouble( String namespaceURI, String localName )
throws XMLParsingException, XMLStreamException {
require( START_ELEMENT, namespaceURI, localName );
return getElementTextAsDouble();
}
代码示例来源:origin: deegree/deegree3
/**
* Creates printable (debug) information about the event that the cursor of the given <code>XMLStreamReader</code>
* currently points at.
*
* @return printable information
*/
public final String getCurrentEventInfo() {
String s = getEventTypeString( getEventType() );
if ( getEventType() == START_ELEMENT || getEventType() == END_ELEMENT ) {
s += ": " + getName();
}
Location location = getLocation();
s += " at line " + location.getLineNumber() + ", column " + location.getColumnNumber() + " (character offset "
+ getLocation().getCharacterOffset() + ")";
return s;
}
代码示例来源:origin: deegree/deegree3
String gid = parseGeometryId( xmlStream );
ICRS crs = determineActiveCRS( xmlStream, defaultCRS );
xmlStream.nextTag();
if ( xmlStream.getEventType() == START_ELEMENT ) {
if ( xmlStream.getLocalName().equals( "outerBoundaryIs" ) ) {
if ( xmlStream.nextTag() != START_ELEMENT ) {
String msg = "Error in 'gml:Polygon' element. Expected a 'gml:LinearRing' element.";
throw new XMLParsingException( xmlStream, msg );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, GML21NS, "outerBoundaryIs" );
xmlStream.nextTag();
while ( xmlStream.getEventType() == START_ELEMENT ) {
if ( xmlStream.getLocalName().equals( "innerBoundaryIs" ) ) {
if ( xmlStream.nextTag() != START_ELEMENT ) {
String msg = "Error in 'gml:Polygon' element. Expected a 'gml:LinearRing' element.";
throw new XMLParsingException( xmlStream, msg );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, GML21NS, "innerBoundaryIs" );
} else {
String msg = "Error in 'gml:Polygon' element. Expected a 'gml:innerBoundaryIs' element, but found: '"
+ xmlStream.getName() + "'.";
throw new XMLParsingException( xmlStream, msg );
xmlStream.nextTag();
代码示例来源:origin: deegree/deegree3
xmlStream.nextTag();
Points points = parseControlPoints( xmlStream, defaultCRS );
int degree = xmlStream.getElementTextAsPositiveInteger( gmlNs, "degree" );
while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
if ( !"knot".equals( xmlStream.getLocalName() ) ) {
break;
xmlStream.nextTag();
xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "Knot" );
xmlStream.nextTag();
double value = xmlStream.getElementTextAsDouble( gmlNs, "value" );
xmlStream.nextTag();
int multiplicity = xmlStream.getElementTextAsPositiveInteger( gmlNs, "multiplicity" );
xmlStream.nextTag();
double weight = xmlStream.getElementTextAsDouble( gmlNs, "weight" );
xmlStream.nextTag();
xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Knot" );
xmlStream.nextTag();
xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "knot" );
knots.add( new Knot( value, multiplicity, weight ) );
throw new XMLParsingException( xmlStream, msg );
xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Bezier" );
return geomFac.createBezier( points, degree, knots.get( 0 ), knots.get( 1 ) );
代码示例来源:origin: deegree/deegree3
StringReader sr = new StringReader( filters[i] );
XMLAdapter adapter = new XMLAdapter( sr );
XMLStreamReaderWrapper streamWrapper = new XMLStreamReaderWrapper(
adapter.getRootElement().getXMLStreamReaderWithoutCaching(),
adapter.getSystemId() );
try {
streamWrapper.nextTag();
filter = Filter110XMLDecoder.parse( streamWrapper );
} catch ( XMLParsingException e ) {
代码示例来源:origin: deegree/deegree3
protected Length parseLengthType( XMLStreamReaderWrapper xmlStream )
throws XMLStreamException {
String uom = xmlStream.getAttributeValue( null, "uom" );
if ( uom == null ) {
String msg = "Required attribute 'uom' missing in element '" + xmlStream.getName() + "'.";
throw new XMLParsingException( xmlStream, msg );
}
String s = xmlStream.getElementText();
BigDecimal value = new BigDecimal( 0.0 );
try {
value = new BigDecimal( s );
} catch ( NumberFormatException e ) {
String msg = "Error in element '" + xmlStream.getName() + "': expected a double value, but found '" + s
+ "'.";
throw new XMLParsingException( xmlStream, msg );
}
return new Length( value, uom );
}
代码示例来源:origin: deegree/deegree3
String interpolationAttrValue = xmlStream.getAttributeValueWDefault( "interpolation", "polynomialSpline" );
if ( "rationalSpline".equals( interpolationAttrValue ) ) {
isPolynomial = true;
} else {
String msg = "Invalid value ('" + interpolationAttrValue + "') for interpolation attribute in element '"
+ xmlStream.getName() + "'. Must be 'rationalSpline' or 'polynomialSpline'.";
throw new XMLParsingException( xmlStream, msg );
xmlStream.nextTag();
Points points = parseControlPoints( xmlStream, defaultCRS );
int degree = xmlStream.getElementTextAsPositiveInteger( gmlNs, "degree" );
while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT ) {
if ( !"knot".equals( xmlStream.getLocalName() ) ) {
break;
xmlStream.nextTag();
xmlStream.require( XMLStreamConstants.START_ELEMENT, gmlNs, "Knot" );
xmlStream.nextTag();
double value = xmlStream.getElementTextAsDouble( gmlNs, "value" );
xmlStream.nextTag();
int multiplicity = xmlStream.getElementTextAsPositiveInteger( gmlNs, "multiplicity" );
xmlStream.nextTag();
double weight = xmlStream.getElementTextAsDouble( gmlNs, "weight" );
xmlStream.nextTag();
xmlStream.require( XMLStreamConstants.END_ELEMENT, gmlNs, "Knot" );
xmlStream.nextTag();
代码示例来源:origin: deegree/deegree3
throws XMLParsingException, XMLStreamException, UnknownCRSException {
xmlStream.nextTag();
xmlStream.require( START_ELEMENT, gmlNs, "refLocation" );
xmlStream.nextTag();
xmlStream.require( START_ELEMENT, gmlNs, "AffinePlacement" );
AffinePlacement referenceLocation = parseAffinePlacement( xmlStream, defaultCRS );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, gmlNs, "refLocation" );
xmlStream.nextTag();
double scaleFactor = xmlStream.getElementTextAsDouble( gmlNs, "scaleFactor" );
xmlStream.nextTag();
double startParameter = xmlStream.getElementTextAsDouble( gmlNs, "startParameter" );
xmlStream.nextTag();
double endParameter = xmlStream.getElementTextAsDouble( gmlNs, "endParameter" );
xmlStream.nextTag();
xmlStream.require( END_ELEMENT, gmlNs, "Clothoid" );
return geomFac.createClothoid( referenceLocation, scaleFactor, startParameter, endParameter );
代码示例来源:origin: deegree/deegree3
private Points parseControlPoints( XMLStreamReaderWrapper xmlStream, ICRS crs )
throws XMLStreamException {
List<Point> controlPoints = null;
if ( xmlStream.getEventType() == XMLStreamConstants.START_ELEMENT ) {
String name = xmlStream.getLocalName();
if ( "coordinates".equals( name ) ) {
controlPoints = parseCoordinates( xmlStream, crs );
xmlStream.nextTag();
} else {
controlPoints = new LinkedList<Point>();
do {
name = xmlStream.getLocalName();
if ( "coord".equals( name ) ) {
double[] coords = parseCoordType( xmlStream );
// anonymous point (no registering necessary)
controlPoints.add( geomFac.createPoint( null, coords, crs ) );
} else {
break;
}
} while ( xmlStream.nextTag() == XMLStreamConstants.START_ELEMENT );
}
}
return geomFac.createPoints( controlPoints );
}
代码示例来源:origin: deegree/deegree3
int event = xmlStream.nextTag();
if ( event != XMLStreamConstants.START_ELEMENT || !GML_X.equals( xmlStream.getName() ) ) {
String msg = "Invalid 'gml:coords' element. Must contain an 'gml:X' element.";
throw new XMLParsingException( xmlStream, msg );
double x = xmlStream.getElementTextAsDouble();
event = xmlStream.nextTag();
if ( event == XMLStreamConstants.END_ELEMENT ) {
return new double[] { x };
if ( event != XMLStreamConstants.START_ELEMENT || !GML_Y.equals( xmlStream.getName() ) ) {
String msg = "Invalid 'gml:coords' element. Second child element must be a 'gml:Y' element.";
throw new XMLParsingException( xmlStream, msg );
double y = xmlStream.getElementTextAsDouble();
event = xmlStream.nextTag();
if ( event == XMLStreamConstants.END_ELEMENT ) {
return new double[] { x, y };
if ( event != XMLStreamConstants.START_ELEMENT || !GML_Z.equals( xmlStream.getName() ) ) {
String msg = "Invalid 'gml:coords' element. Third child element must be a 'gml:Z' element.";
throw new XMLParsingException( xmlStream, msg );
double z = xmlStream.getElementTextAsDouble();
event = xmlStream.nextTag();
if ( event != XMLStreamConstants.END_ELEMENT ) {
xmlStream.skipElement();
代码示例来源:origin: deegree/deegree3
/**
* Not piped to wrapped reader, because AXIOM provided reader (withoutCaching) behaves strange here.
*/
@Override
public String getElementText()
throws XMLStreamException {
if ( getEventType() != XMLStreamConstants.START_ELEMENT ) {
throw new XMLStreamException( "parser must be on START_ELEMENT to read next text", getLocation() );
}
int eventType = next();
StringBuilder content = new StringBuilder();
while ( eventType != XMLStreamConstants.END_ELEMENT ) {
if ( eventType == XMLStreamConstants.CHARACTERS || eventType == XMLStreamConstants.CDATA
|| eventType == XMLStreamConstants.SPACE || eventType == XMLStreamConstants.ENTITY_REFERENCE ) {
content.append( getText() );
} else if ( eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
|| eventType == XMLStreamConstants.COMMENT ) {
// skipping
} else if ( eventType == XMLStreamConstants.END_DOCUMENT ) {
throw new XMLStreamException( "unexpected end of document when reading element text content",
getLocation() );
} else if ( eventType == XMLStreamConstants.START_ELEMENT ) {
throw new XMLStreamException( "element text content may not contain START_ELEMENT", getLocation() );
} else {
throw new XMLStreamException( "Unexpected event type " + eventType, getLocation() );
}
eventType = next();
}
return content.toString();
}
代码示例来源:origin: deegree/deegree3
LOG.debug( "- parsing feature, gml:id=" + fid + " (begin): " + xmlStream.getCurrentEventInfo() );
QName featureName = xmlStream.getName();
FeatureType ft = lookupFeatureType( xmlStream, featureName, false );
if ( ft == null ) {
while ( xmlStream.getEventType() == START_ELEMENT ) {
QName propName = xmlStream.getName();
LOG.debug( "- property '" + propName + "'" );
xmlStream.nextTag();
if ( lastPropDecl != propDecl ) {
lastPropDecl = propDecl;
代码示例来源:origin: deegree/deegree3
List<Property> propertyList = new ArrayList<Property>();
xmlStream.nextTag();
while ( xmlStream.getEventType() == START_ELEMENT ) {
QName propName = xmlStream.getName();
if ( LOG.isDebugEnabled() ) {
LOG.debug( "- property '" + propName + "'" );
xmlStream.nextTag();
continue;
xmlStream.nextTag();
代码示例来源:origin: deegree/deegree3
private Feature readProperty()
throws XMLParsingException, XMLStreamException, UnknownCRSException {
Feature feature = null;
int event = xmlStream.getEventType();
if ( event == START_ELEMENT ) {
QName propName = xmlStream.getName();
if ( LOG.isDebugEnabled() ) {
LOG.debug( "- property '" + propName + "'" );
xmlStream.next();
return feature;
代码示例来源:origin: deegree/deegree3
/**
* Starts the validation.
*
* @throws XMLStreamException
* @throws UnknownCRSException
*/
public void validateGeometries()
throws XMLStreamException, UnknownCRSException {
while ( xmlStream.getEventType() != END_DOCUMENT ) {
if ( xmlStream.isStartElement() ) {
if ( gmlStream.isGeometryElement() ) {
validateGeometryElement();
}
}
xmlStream.next();
}
}
代码示例来源:origin: deegree/deegree3
private void validateInterpolationAttribute( XMLStreamReaderWrapper xmlStream, String expected )
throws XMLParsingException {
String actual = xmlStream.getAttributeValue( null, "interpolation" );
if ( actual != null && !expected.equals( actual ) ) {
String msg = "Invalid value (='" + actual + "') for interpolation attribute in element '"
+ xmlStream.getName() + "'. Must be '" + expected + "'.";
throw new XMLParsingException( xmlStream, msg );
}
}
}
正如标题中所问,我有两个如下结构的 XML 文件 A.xml //here I want to include B.xml
我有一个 xml 文件。根据我的要求,我需要更新空标签,例如我需要更改 to .是否可以像那样更改标签.. 谢谢... 最佳答案 var xmlString=" "; var properStri
我有这样简单的 XML: Song Playing 09:41:18 Frederic Delius Violin Son
在我的工作中,我们有自己的 XML 类来构建 DOM,但我不确定应该如何处理连续的空格? 例如 Hello World 当它被读入 DOM 时,文本节点应该包含 Hello 和 World
我有以下 2 个 xml 文件,我必须通过比较 wd:Task_Name_ID 和 TaskID 的 XML 文件 2。 例如,Main XML File-1 wd:Task_Name_ID 具有以下
我在 Rails 应用程序中有一个 XML View ,需要从另一个文件插入 XML 以进行测试。 我想说“构建器,只需盲目地填充这个字符串,因为它已经是 xml”,但我在文档中看不到这样做的任何内容
我正在重建一些 XML 提要,因此我正在研究何时使用元素以及何时使用带有 XML 的属性。 一些网站说“数据在元素中,元数据在属性中。” 那么,两者有什么区别呢? 让我们以 W3Schools 为例:
在同一个文档中有两个 XML 声明是否是格式正确的 XML? hello 我相信不是,但是我找不到支持我的消息来源。 来自 Extensible Markup Language
我需要在包装器 XML 文档中嵌入任意(语法上有效的)XML 文档。嵌入式文档被视为纯文本,在解析包装文档时不需要可解析。 我知道“CDATA trick”,但如果内部 XML 文档本身包含 CDAT
XML 解析器和 XML 处理器是两个不同的东西吗?他们是两个不同的工作吗? 最佳答案 XML 解析器和 XML 处理器是一样的。它不适用于其他语言。 XML 是通用数据标记语言。解析 XML 文件已
我使用这个 perl 代码从一个文件中读取 XML,然后写入另一个文件(我的完整脚本有添加属性的代码): #!usr/bin/perl -w use strict; use XML::DOM; use
我正在编写一个我了解有限的历史脚本。 对象 A 的类型为 system.xml.xmlelement,我需要将其转换为类型 system.xml.xmldocument 以与对象 B 进行比较(类型
我有以下两个 XML 文件: 文件1 101 102 103 501 502 503
我有以下两个 XML 文件: 文件1 101 102 103 501 502 503
我有一个案例,其中一个 xml 作为输入,另一个 xml 作为输出:我可以选择使用 XSL 和通过 JAXB 进行 Unmarshalling 编码。性能方面,有什么真正的区别吗? 最佳答案 首先,程
我有包含 XML 的 XML,我想使用 JAXB 解析它 qwqweqwezxcasdasd eee 解析器 public static NotificationRequest parse(Strin
xml: mario de2f15d014d40b93578d255e6221fd60 Mario F 23 maria maria
尝试更新 xml 文件数组时出现以下错误。 代码片段: File dir = new File("c:\\XML"); File[] files = dir.listFiles(new Filenam
我怎样才能完成这样的事情: PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date=(Get-Date | ConvertT
我在从 xml 文件中删除节点时遇到一些困难。我发现很多其他人通过各种方式在 powershell 中执行此操作的示例,下面的代码似乎与我见过的许多其他示例相同,但我没有得到所需的行为。 我的目标是将
我是一名优秀的程序员,十分优秀!