I need to create a new XML document from another XML document. The new
document is contained with in the item element tags of the original
document. The problem is I can have any type (i.e. root element of the
inter message) of root element inside the item tags and as such I have
to create my scheme for that content as follows (unless some one has a
better way):
The schema segment is as follows (I just want what's in the Item element):
<xsd:element name="releaseRequest">
<xsd:annotation>
<xsd:documentation>
Message from DBS to external MeSH on a domain export
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Time" type="xsd:dateTime"/>
<xsd:element name="Item">
<xsd:complexType>
<xsd:sequence>
<xsd:any namespace="##any"
processContents="strict"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
the original document:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:releaseRequest xmlns="urn:us:gov:dod:army:cerdec:jbfsa:csds:r1"
xmlns:ism="urn:us:gov:ic:ism:v2"
xmlns:ns1="urn:us:gov:dod:army:cerdec:jbfsa:csds:r1"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:us:gov:dod:army:cerdec:jbfsa:csds:r1
C:\data\JBFSA\r1\csds_src\config\csds_msgs.xsd">
<ns1:Time>2001-12-17T09:30:47.0Z</ns1:Time>
<ns1:Item>
<ns2:advertiseSS
advertisementID="1b094a9d-063b-409b-8a3b-923061a5c983"
commandDateTime="2006-05-25T09:49:56.593-04:00" userID="peer"
xmlns="
http://mitre.org/DDS" xmlns:ns2="
http://mitre.org/DDS">
<ns2:returnAddress>
http://128.96.185.16:8080/DDS/services/DDS</ns2:returnAddress>
<ns2:sourceAddress>
http://128.96.185.16:8080/DDS/services/DDS</ns2:sourceAddress>
<ns2:metadata>
<ns1:title ns2:classification="U" ns2:ownerProducer="USA"
xmlns:ns1="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns2="urn:us:gov:ic:ism:v2">MCS_DEMO</ns1:title>
<ns3:description ns4:classification="U" ns4:ownerProducer="USA"
xmlns:ns3="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns4="urn:us:gov:ic:ism:v2">MCS_Desc</ns3:description>
<ns5:creator ns6:classification="U" ns6:ownerProducer="USA"
xmlns:ns5="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns6="urn:us:gov:ic:ism:v2">
<ns5:Organization><ns5:name>MCS</ns5:name></ns5:Organization>
</ns5:creator>
<ns7:subjectCoverage xmlns:ns7="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/">
<ns7:Subject><ns7:category ns7:label="Ground"/>
<ns7:keyword ns7:value="MCSAdv1"/>
</ns7:Subject>
</ns7:subjectCoverage>
<ns8:temporalCoverage
xmlns:ns8="
http://mitre.org/DDS/metadata"><ns8:start>2006-05-25T09:38:10-04:00</ns8:start><ns8:end>2006-05-25T14:38:10-04:00</ns8:end></ns8:temporalCoverage>
<ns9:geospatialCoverage xmlns:ns9="
http://mitre.org/DDS/metadata">
<ns9:lowerCorner>-170.0 46.0</ns9:lowerCorner><ns9:upperCorner>-169.0
47.0</ns9:upperCorner>
</ns9:geospatialCoverage>
<ns10:security ns11:classification="U" ns11:ownerProducer="USA"
xmlns:ns10="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns11="urn:us:gov:ic:ism:v2"/><ns12:identifier
ns12:qualifier="Test" ns12:value="value"
xmlns:ns12="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"/>
</ns2:metadata>
<ns2:hopCount>1</ns2:hopCount>
</ns2:advertiseSS>
</ns1:Item>
</ns1:releaseRequest>
What I want in my new XML document (but remember advertiseSS is
variable can be anything in here):
<ns2:advertiseSS advertisementID="1b094a9d-063b-409b-8a3b-923061a5c983"
commandDateTime="2006-05-25T09:49:56.593-04:00" userID="peer"
xmlns="
http://mitre.org/DDS" xmlns:ns2="
http://mitre.org/DDS">
<ns2:returnAddress>
http://128.96.185.16:8080/DDS/services/DDS</ns2:returnAddress>
<ns2:sourceAddress>
http://128.96.185.16:8080/DDS/services/DDS</ns2:sourceAddress>
<ns2:metadata>
<ns1:title ns2:classification="U" ns2:ownerProducer="USA"
xmlns:ns1="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns2="urn:us:gov:ic:ism:v2">MCS_DEMO</ns1:title>
<ns3:description ns4:classification="U" ns4:ownerProducer="USA"
xmlns:ns3="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns4="urn:us:gov:ic:ism:v2">MCS_Desc</ns3:description>
<ns5:creator ns6:classification="U" ns6:ownerProducer="USA"
xmlns:ns5="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns6="urn:us:gov:ic:ism:v2">
<ns5:Organization><ns5:name>MCS</ns5:name></ns5:Organization>
</ns5:creator>
<ns7:subjectCoverage xmlns:ns7="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/">
<ns7:Subject><ns7:category ns7:label="Ground"/>
<ns7:keyword ns7:value="MCSAdv1"/>
</ns7:Subject>
</ns7:subjectCoverage>
<ns8:temporalCoverage
xmlns:ns8="
http://mitre.org/DDS/metadata"><ns8:start>2006-05-25T09:38:10-04:00</ns8:start><ns8:end>2006-05-25T14:38:10-04:00</ns8:end></ns8:temporalCoverage>
<ns9:geospatialCoverage xmlns:ns9="
http://mitre.org/DDS/metadata">
<ns9:lowerCorner>-170.0 46.0</ns9:lowerCorner><ns9:upperCorner>-169.0
47.0</ns9:upperCorner>
</ns9:geospatialCoverage>
<ns10:security ns11:classification="U" ns11:ownerProducer="USA"
xmlns:ns10="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"
xmlns:ns11="urn:us:gov:ic:ism:v2"/><ns12:identifier
ns12:qualifier="Test" ns12:value="value"
xmlns:ns12="
http://metadata.dod.mil/mdr/ns/DDMS/1.2/"/>
</ns2:metadata>
<ns2:hopCount>1</ns2:hopCount>
</ns2:advertiseSS>
So I don't know what type of message to create as the root element of
the inter document is variable. Plus with jaxb not sure how I would know
what anything is as all examples see to assume you know what type of
data your dealing with and I don't know until I'm ale to read something
from the document. Is this probably a DOM solution then?
Thanks,
Frank