Hybrid Integration 10.2 | Integrating Cloud Applications on Software AG Hosted Environment | Integration Cloud | Develop | Integrations | Built-In Services | XML | Summary of XML services | xmlStreamToDocument
 
xmlStreamToDocument
Converts an XML content stream to a document. This service transforms each element and attribute in the XML content stream to an element in a Document.
This service will convert the XML stream containing the following XML content:
<?xml version="1.0" ?>
<tns:AcctInfo>
xmlns:tns="http://localhost/DerivedAddress/schema.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>Midwest Extreme Sports</name>
<rep>Laura M. Sanchez</rep>
<acctNum type=platinum>G97041A</acctNum>
<phoneNum cc=011>216-741-7566</phoneNum>
<address country=USA>
<street1>10211 Brook Road</street1>
<city>Cleveland</city>
<state>OH</state>
<postalCode>22130</postalCode>
</address>
<address country=USA xsi:type="tns:DerivedAddress">
<street1>10211 Brook Road</street1>
<city>Cleveland</city>
<state>OH</state>
<postalCode>22130</postalCode>
<landMark>Besides Ohio River-Bank Square</landMark>
<telNo>001222555</telNo>
</address>
<serialNum>19970523A</serialNum>
<serialNum>20001106G</serialNum>
<serialNum>20010404K</serialNum>
</tns:AcctInfo>
To a Document that looks like:
Input Parameters
xmlStream
java.io.InputStream. XML content stream that is to be converted to a document.
nsDecls [ ]
Document. Optional. Namespace prefixes to use for the conversion. This parameter specifies the prefixes that will be used when namespace-qualified elements are converted to key names in the resulting document object. For example, if you want elements belonging to a particular namespace to have the prefix GSX in the resulting document, for example, GSX:acctNum, you would associate the prefix GSX with that namespace in nsDecls . This is important because incoming XML documents can use any prefix for a given namespace, but the key names expected by a target service will have a fixed prefix. Namespace prefixes in nsDecls also define the prefixes used by the arrays, documents, documentTypeName, and collect parameters. Each entry in nsDecls represents a namespace prefix/URI pair, where a key name represents a prefix and the value of the key specifies the namespace URI. For example, to define the URIs associated with two prefixes called GSX and TxMon, you would set nsDecls as follows:
Parameters for nsDecls [ ] are:
prefix: Key name.
uri: Key value.
preserveUn declaredNS
String Optional. Flag indicating whether or not Integration Cloud keeps undeclared namespaces in the resulting document. An undeclared namespace is one that is not specified as part of the nsDecls input parameter.
Set to:
*True to preserve undeclared namespaces in the resulting document. For each namespace declaration in the XML document that is not specified in the nsDecls parameter, Integration Cloud adds the xmlns attribute as a String variable to the document. Integration Cloud gives the variable a name that begins with "@xmlns" and assigns the variable the namespace value specified in the XML document. Integration Cloud preserves the position of the undeclared namespace in the resulting document.
*False to ignore namespace declarations in the XML document that are not specified in the nsDecls parameter. This is the default.
preserveNS Positions
String Optional. Flag indicating whether or not Integration Cloud maintains the position of namespaces declared in the nsDecls parameter in the resulting document.
Set to:
*True to preserve the position of namespaces declared in nsDecls in the resulting document. For each namespace specified in the nsDecls parameter, Integration Cloud adds the xmlns attribute to the document as a String variable named "@xmlns:NSprefix" where "NSprefix" is the prefix name specified in nsDecls. Integration Cloud assigns the variable the namespace value specified in the XML document. This variable maintains the position of the xmlns attribute declaration within the XML document.
*False to not maintain the position of the namespace declarations specified in nsDecls in the resulting document. This is the default.
Output Parameters
document
Document. Document representation of nodes and attributes in node.
Usage Notes
Following are examples of XML documents and the documents that xmlStreamToDocument will produce:
XML Document
Document
<myDoc><e1>e1Value</e1>
</myDoc>
<?xml version="1.0" encoding="UTF-8"
standalone="no"?><myDoc><e1>
e1Value</e1></myDoc>
<?xml version="1.0" encoding="UTF-8"
standalone="no"?><myDoc>
<e1 e1Attr="attrValue">
e1Value</e1></myDoc>
<?xml version="1.0" encoding="UTF-8"
standalone="no"?><myDoc>
<e1>e1Value</e1><e2>e2Value</e2>
</myDoc>
<?xml version="1.0" encoding="UTF-8"
standalone="no"?><myDoc><e1>
e1Value1</e1><e2>
e2Value</e2><e1>
e1Value2</e1></myDoc>
<?xml version="1.0"encoding="UTF-8"?>
<myDoc><e1 e1Attr="attrValue1">
e1Value1</e1><e2>e2Value</e2>
<e1 e1Attr="attrValue2">e1Value2
</e1></myDoc>
<?xml version="1.0"encoding="UTF-8"?>
<myDoc><e1 e1Attr="attrValue1">
e1Value1</e1><e2>
e2Value</e2><e1 e1Attr="attrValue2">
e1Value2</e1></myDoc>
<?xml version="1.0"encoding="UTF-8"?>
<myDoc><e1 e1Attr="attrValue1">
e1Value1</e1><e2>e2Value</e2>
<e1 e1Attr="attrValue2">
e1Value2</e1>
</myDoc>
<?xml version="1.0"encoding="UTF-8"?>
<myDoc><e1 e1Attr="attrValue1">
e1Value1
</e1><e2><e3>e3Value</e3>
<e4 e4Attr=
"attrValue4"e4Attrb="attrValue4b">
e4Value
</e4></e2></myDoc>
<?xml version="1.0" encoding="UTF-8"
standalone="no"?><tns:AcctInfo>
xmlns:tns="http://localhost/
DerivedAddress/
schema.xsd"xmlns:xsi="http://www
.w3.org/
2001/XMLSchema-instance"><myDoc>
<e1>e1Value</e1></myDoc>
<myDoc xsi:type="tns:DerivedDoc">
<e1>e1Value</e1><e2>e2Value</e2>
</myDoc>
</tns:AcctInfo>

Copyright © 2015- 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.