Hi Nirmal.
 
What happends if you just get the first child from the domnode?
 
Node node = messagetext.getDomNode().getFirstChild();
AppHdr ah = AppHdr.Factory.parse( node );
 
node = messagetext.getDomNode().getLastChild();
Document doc = Document.Factory.parse( node );
 
or with cursor:
 
  XmlCursor cur = messagetext.newCursor();
  cur.toChild( 0 );
  AppHdr ah = AppHdr.Factory.parse( cur.getDomNode() );
  
  cur.toNextSibling();

  Document doc = Document.Factory.parse( cur.getDomNode() );
  

 
Regards
 
/Mikael

________________________________

Från: jadiyo [mailto:[EMAIL PROTECTED]
Skickat: to 2006-04-20 15:31
Till: [email protected]
Ämne: <xml-fragment> containing well formed XML Documents




Hi,

I seem to be having a problem that a lot of people are experiencing!
I am working with a 3rd party schema which has the following type
definition:

        .....
        .....
        <xs:complexType name="Text" mixed="true">
                <xs:complexContent>
                        <xs:extension base="xs:anyType">
                                <xs:sequence />
                        </xs:extension>
                </xs:complexContent>
        </xs:complexType>

        <xs:element name="MessageText" type="Text" />

        .....

        .....


The MessageText element is defined to hold anyType.  In my case, it actually
holds at
least 2 (well formed/complete) XML documents.

The XML shown below is a snippet of the overall XML reveived.


    <MessageText>
      <ah:AppHdr xmlns:ah="urn:swift:xsd:$ahV10">
        <ah:MsgRef>the message ref</ah:MsgRef>
        <ah:CrDate>2006-04-18T16:04:55.739+01:00</ah:CrDate>
      </ah:AppHdr>
      <Doc:Document xmlns:Doc="urn:swift:xsd:swift.ia$setr.010.001.02">
        <Doc:setr.010.001.02>
          <Doc:MsgNm>setr.010.001.02</Doc:MsgNm>
        </Doc:setr.010.001.02>
      </Doc:Document>
    </MessageText>


AppHdr is a complete XML document in its own right, as is
Document.

When I use XMLBeans to get to the MessageText content, it gets wrapped
in an <xml-fragment> as shown below.


<xml-fragment xmlns:urn="urn:swift:xsd:saa.mxs.01>
      <ah:AppHdr xmlns:ah="urn:swift:xsd:$ahV10">
        <ah:MsgRef>the message ref</ah:MsgRef>
        <ah:CrDate>2006-04-18T16:04:55.739+01:00</ah:CrDate>
      </ah:AppHdr>
      <Doc:Document xmlns:Doc="urn:swift:xsd:swift.ia$setr.010.001.02">
        <Doc:setr.010.001.02>
          <Doc:MsgNm>setr.010.001.02</Doc:MsgNm>
        </Doc:setr.010.001.02>
      </Doc:Document>
</xml-fragment>



I need to extract AppHdr and Document individually so they they themsleves
can be
parsed with XMLBeans.



I'd appreciate any help at all.



Many Thanks



Nirmal


--
View this message in context: 
http://www.nabble.com/%3Cxml-fragment%3E-containing-well-formed-XML-Documents-t1480526.html#a4007281
Sent from the Xml Beans - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to