Hopefully that works with XMLBeans because prefix declarations are maintained 
:-)
 
But this won't:
 
<foo
   xmlns="http://foobaz"/>
 
because insignificant space is not tracked. When the documentation refers to 
the "original, native XML structure", it means the XML structure as defined by 
the XML and XML Infoset specifications. But there are a few things which are 
not significant in XML (like the spaces above, or when character references or 
entities are used vs the characters themsleves) that XMLBeans doesn't keep 
track of. There aren't that many, because XMLBeans goes beyond the letter of 
the specifications, but in a large document, chances to hit one of these is 
large.
 
If you want to use XML with digital signatures, there are specs that describe 
how to do it (taking particularities of XML into account) and, though I have 
not tried it myself, I have seen messages on this list from people who have 
tried and apparently had some success.
 
One more think, you can try setting XmlOptions.setCDataBookmarks() to eliminate 
one more potential source of differences, but for a robust solution you need to 
look at the "XML Signature" spec.
 
Radu



________________________________

        From: Jacob Danner [mailto:[EMAIL PROTECTED] 
        Sent: Monday, September 15, 2008 8:27 AM
        To: [email protected]
        Subject: Re: Very simple question (I think)
        
        
        For XML to be equivalent, things like namespace prefixes, whitespace*, 
etc can be different. With Strings, this is not the case. 
        For example:
        <foo xmlns="http://foobaz"; /> 
        and
        <baz:foo xmlns:baz="http://foobaz"; />
        Are equivalent in XML.
        
        If you are hoping to do an == check using the above with strings it 
will ALWAYS fail with String.equals.
        Why not try
        XMLObject.[compareTo|compareValue|valueEquals]
        ?
        
        -jacobd
        
        
        
        On Mon, Sep 15, 2008 at 7:14 AM, Nicolai Odum <[EMAIL PROTECTED]> wrote:
        


                Sorry - but no good 
                
                From the javadoc 
                

                toString 
                String 
<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html>  toString() 
                Returns an XML string for this XML object. 

                The string is pretty-printed. If you want a non-pretty-printed 
string, or if you want to control options precisely, use the xmlText() methods. 

                

                

                /Nicolai
                
                CSC . This is a PRIVATE message. If you are not the intended 
recipient, please delete without copying and kindly advise us by e-mail of the 
mistake in delivery.  NOTE: Regardless of content, this e-mail shall not 
operate to bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose . CSC Danmark A/S . Registered Office: Retortvej 8, DK 
-1780 Copenhagen V , Denmark . Registered in Denmark No: 15231599
                
                
                
                
"Andrew Mansfield" <[EMAIL PROTECTED]> 

15-09-2008 16:13

Please respond to
[email protected]

To
<[email protected]>      
cc
        
Subject
RE: Very simple question (I think)      

                




                try parse.toString(); 
                
                
________________________________

                From: Nicolai Odum [mailto:[EMAIL PROTECTED] 
                Sent: 15 September 2008 15:09
                To: [email protected]
                Subject: RE: Very simple question (I think)
                
                
                I will try again :-) 
                
                Sorry for my pore english skills. 
                
                When I say invalid i mean that the generated hash value no 
longer is valid...I can work with the xml beans structure but I need acces to 
the untouched, native, raw xml string that I used as a argument to the factory. 
                
                XmlObject parse = XmlObject.Factory.parse(xml); 
                
                
                /Nicolai 
                
                CSC . This is a PRIVATE message. If you are not the intended 
recipient, please delete without copying and kindly advise us by e-mail of the 
mistake in delivery.  NOTE: Regardless of content, this e-mail shall not 
operate to bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use of 
e-mail for such purpose . CSC Danmark A/S . Registered Office: Retortvej 8, DK 
-1780 Copenhagen V , Denmark . Registered in Denmark No: 15231599
                
                
                
"Andrew Mansfield" <[EMAIL PROTECTED]> 

15-09-2008 15:58 


Please respond to
[email protected]



To
<[email protected]>      
cc
        
Subject
RE: Very simple question (I think)      


                


                
                
                
                I just ran the following Junit test with no problems... 
                  

                public void test() throws XmlException, IOException{ 

                String xmltext = new 
String("<test><element1>testvalue</element1></test>"); 

                XmlObject xmlObject = XmlObject.Factory.parse(new 
ByteArrayInputStream(xmltext.getBytes())); 

                Node rootnode = xmlObject.getDomNode().getFirstChild(); 

                assertEquals("test",rootnode.getNodeName()); 

                } 

                
                
                

________________________________

                From: Nicolai Odum [mailto:[EMAIL PROTECTED] 
                Sent: 15 September 2008 14:41
                To: [email protected]
                Subject: RE: Very simple question (I think)
                
                
                Sorry bad example 
                
                It's was just  suppose to be psudo code 
                
                String xml = "big xml document"; 
                
                I have tried it with many big valid xml documents - without 
luck. 
                
                /Nicolai 
                
                
"Andrew Mansfield" <[EMAIL PROTECTED]> 

15-09-2008 15:36 


Please respond to
[email protected]



To
<[email protected]>      
cc
        
Subject
RE: Very simple question (I think)      




                


                
                
                
                
                I think you need to parse a valid source document first. Then 
you can get access to the underlying XmlObject. 
                
                Regards, 
                
                
________________________________

                From: Nicolai Odum [mailto:[EMAIL PROTECTED] 
                Sent: 15 September 2008 14:32
                To: [email protected]
                Subject: Very simple question (I think)
                
                
                Hello 
                
                On xmlbeans.apache.org 
<http://xmlbeans.apache.org/docs/2.0.0/guide/conGettingStartedwithXMLBeans.html>
  it says that XMLBeans provide 
                
                <quote> 
                It provides a familiar Java object-based view of XML data 
without losing access to the original, native XML structure 
                </quote> 
                
                I am using XMLBeans on a xml structure that is signed with a 
hash value so *nothing* must change before the xml is invalid. 
                
                The question is: *HOW* do i get access to the original, native 
XML structure. 
                
                because this doesn't work 
                
                String xml = "big xml document"; 
                XmlObject parse = XmlObject.Factory.parse(xml); 
                String newXml = parse.xmlText(); 
                
                if (xml.equals(newXml) 
                     System.out.println("jubii"); 
                else 
                     System.out.println("damn"); 
                
                
                
                Please help :-) 
                
                Cheers 
                
                Nicolai 
                  
________________________________

                
                This email with all information contained herein or attached 
hereto may contain confidential and/or privileged information intended for the 
addressee(s) only. If you have received this email in error, please contact the 
sender and immediately delete this email in its entirety and any attachments 
thereto. 
                (W1) 
                
                
                  
________________________________

                
                This email with all information contained herein or attached 
hereto may contain confidential and/or privileged information intended for the 
addressee(s) only. If you have received this email in error, please contact the 
sender and immediately delete this email in its entirety and any attachments 
thereto. 
                (W1) 
                
                
                  
________________________________


                This email with all information contained herein or attached 
hereto may contain confidential and/or privileged information intended for the 
addressee(s) only. If you have received this email in error, please contact the 
sender and immediately delete this email in its entirety and any attachments 
thereto. 
                (W1) 
                
                
                


Reply via email to