[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    Re: Problem with  XmlObject.Factory.parse
From:       Radu Preotiuc-Pietro <radup () bea ! com>
Date:       2006-11-09 18:59:53
Message-ID: 1163098793.2761.13.camel () radup02 ! bea ! com
[Download RAW message or body]

I wouldn't worry so much about what the debugger says. Parsing will not
modify your document's infoset in any way, saving may. The debugger just
calls the .toString() method on XmlObject. Now this generic toString()
method has to work whether your document is parsed or modified or
created from scratch and have a sensible and easy-to-read result, but it
cannot be expected to return the perfect serialization for your
particular XML.

In practice, once you presumably make some changes to the document, you
would use XmlObject.xmlText(XmlOptions) to save it out, which gives you
more control over how the serialized form of the document looks.

So I would take what the .toString() method returns with a grain of salt
and not consider the namespace declarations indicative of what's really
in the internal representation of the document.

Radu

On Thu, 2006-11-09 at 18:07 +0000, Sandra Mendez wrote:
> Hello,
> 
> I have the following xml document, valid according to a schema.
> 
> <first  xmlns="http://com.first">
> <second>val</second>
> <enclosing>
> <dsig:Signature xmlns="http://www.w3.org/2000/09/xmldsig#"
> xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="sigenclosing">
> <dsig:SignedInfo Id="sigenclosing-SignedInfo">
> <dsig:CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
> <dsig:SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
> <dsig:Reference URI="">
> <dsig:Transforms>
> <dsig:Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
> </dsig:Transforms>
> <dsig:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <dsig:DigestValue>sPaR/y8BhcZ7azjwjEESiZuFUj0=</dsig:DigestValue>
> </dsig:Reference>
> <dsig:Reference URI="#sigenclosing-SignedProperties">
> <dsig:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <dsig:DigestValue>Jo4nDU4/+sPCX+nXruVpoQp8rS8=</dsig:DigestValue>
> </dsig:Reference>
> </dsig:SignedInfo>
> <dsig:SignatureValue Id="sigenclosing
> Value">pRj0rxmxkI8leH1WQEQhIIAYbtcIcmo8M=</dsig:SignatureValue>
> <dsig:KeyInfo Id="sigenclosing-KeyInfo">
> <dsig:KeyValue>
> <dsig:RSAKeyValue>
> <dsig:Modulus>qeIGBJkYU9Xyn0aS6uU8mVygVrccOR1kiNHlHqPvC6guHM2oB64u9vx/8Px4dzcA0R4uY1wU=</dsig:Modulus>
>  <dsig:Exponent>AQAB</dsig:Exponent>
> </dsig:RSAKeyValue>
> </dsig:KeyValue>
> <dsig:X509Data>
> <dsig:X509Certificate>p56MOIKa+8whxLjSqe1lvgQLxpDJx1aKfJ8qcB1d
> +mEdWae6R3HZpigtzFFCqiok</dsig:X509Certificate>
> </dsig:X509Data>
> </dsig:KeyInfo>
> <dsig:Object>
> <xad:QualifyingProperties
> xmlns="http://uri.etsi.org/01903/v1.2.2#"
> xmlns:xad="http://uri.etsi.org/01903/v1.2.2#" Target="#sigenclosing">
> <xad:SignedProperties Id="sigenclosing-SignedProperties">
> <xad:SignedSignatureProperties>
> <xad:SigningCertificate>
> <xad:Cert>
> <xad:CertDigest>
> <dsig:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <dsig:DigestValue>6Rv0GElerfoe0gH5FBo50b3Otrw=</dsig:DigestValue>
> </xad:CertDigest>
> <xad:IssuerSerial>
> <dsig:X509IssuerName>ou=REAL,ou=AC
> déléguée,ou=Notaires,o=Professions
> Réglementées,c=fr</dsig:X509IssuerName>
> <dsig:X509SerialNumber>716550</dsig:X509SerialNumber>
> </xad:IssuerSerial>
> </xad:Cert>
> </xad:SigningCertificate>
> </xad:SignedSignatureProperties>
> <xad:SignedDataObjectProperties/>
> </xad:SignedProperties>
> <xad:UnsignedProperties>
> <xad:UnsignedSignatureProperties>
> <xad:SignatureTimeStamp Id="sigenclosing-TimeStamp">
> <xad:Include URI="#sigenclosing-Value"/>
> <xad:EncapsulatedTimeStamp>N1vWamMOXstksig=</xad:EncapsulatedTimeStamp>
> </xad:SignatureTimeStamp>
> </xad:UnsignedSignatureProperties>
> </xad:UnsignedProperties>
> </xad:QualifyingProperties>
> </dsig:Object>
> </dsig:Signature>
> </enclosing>
> </first>
> 
> When I do the XmlObject.Factory.parse, after the execution of this
> method XmlBean transforms my xml document (while debugging).  See
> below.
> 
> I realize that when parsing the Signature node, even though that the
> default namespace is defined and a dsig prefix at the Signature level,
> XmlBeans can not find it.  Inside the Signature node, there is the
> QualifyingProperties node.  It is defined with it's default namespace
> and prefix.
> The QualifyingProperties node uses elements of the prefix dsig,
> referenced by the namespace "http://www.w3.org/2000/09/xmldsig#".
> When parsing, the prefixe dsig it's not detected at the signature
> level, however, it is added at the element root with an another prefix
> name identify by xd.  
> And the nodes dsig referenced inside QualifyingProperties have changed
> by the prefix xd.
> 
> I don't understand the way XmlBean does the parsing.  Why my xml
> document has changed?  
> 
> I need the original signature node as it was submitted to the parse
> method.  Could someone tell me please, how XmlBeans analyzes the xml
> document?
> 
> <first  xmlns=http://com.first"
> xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
> <second>val</second>
> <enclosing>
> <dsig:Signature xmlns="http://www.w3.org/2000/09/xmldsig#"
> xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Id="sigenclosing">
> <dsig:SignedInfo Id="sigenclosing-SignedInfo">
> <dsig:CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
> <dsig:SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
> <dsig:Reference URI="">
> <dsig:Transforms>
> <dsig:Transform
> Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
> </dsig:Transforms>
> <dsig:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <dsig:DigestValue>sPaR/y8BhcZ7azjwjEESiZuFUj0=</dsig:DigestValue>
> </dsig:Reference>
> <dsig:Reference URI="#sigenclosing-SignedProperties">
> <dsig:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <dsig:DigestValue>Jo4nDU4/+sPCX+nXruVpoQp8rS8=</dsig:DigestValue>
> </dsig:Reference>
> </dsig:SignedInfo>
> <dsig:SignatureValue Id="sigenclosing
> Value">pRj0rxmxkI8leH1WQEQhIIAYbtcIcmo8M=</dsig:SignatureValue>
> <dsig:KeyInfo Id="sigenclosing-KeyInfo">
> <dsig:KeyValue>
> <dsig:RSAKeyValue>
> <dsig:Modulus>qeIGBJkYU9Xyn0aS6uU8mVygVrccOR1kiNHlHqPvC6guHM2oB64u9vx/8Px4dzcA0R4uY1wU=</dsig:Modulus>
>  <dsig:Exponent>AQAB</dsig:Exponent>
> </dsig:RSAKeyValue>
> </dsig:KeyValue>
> <dsig:X509Data>
> <dsig:X509Certificate>p56MOIKa+8whxLjSqe1lvgQLxpDJx1aKfJ8qcB1d
> +mEdWae6R3HZpigtzFFCqiok</dsig:X509Certificate>
> </dsig:X509Data>
> </dsig:KeyInfo>
> <dsig:Object>
> <xad:QualifyingProperties
> xmlns="http://uri.etsi.org/01903/v1.2.2#"
> xmlns:xad="http://uri.etsi.org/01903/v1.2.2#" Target="#sigenclosing">
> <xad:SignedProperties Id="sigenclosing-SignedProperties">
> <xad:SignedSignatureProperties>
> <xad:SigningCertificate>
> <xad:Cert>
> <xad:CertDigest>
> <xd:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
> <xd:DigestValue>6Rv0GElerfoe0gH5FBo50b3Otrw=</xd:DigestValue>
> </xad:CertDigest>
> <xad:IssuerSerial>
> <xd:X509IssuerName>ou=REAL,ou=AC
> déléguée,ou=Notaires,o=Professions
> Réglementées,c=fr</xd:X509IssuerName>
> <xd:X509SerialNumber>716550</xd:X509SerialNumber>
> </xad:IssuerSerial>
> </xad:Cert>
> </xad:SigningCertificate>
> </xad:SignedSignatureProperties>
> <xad:SignedDataObjectProperties/>
> </xad:SignedProperties>
> <xad:UnsignedProperties>
> <xad:UnsignedSignatureProperties>
> <xad:SignatureTimeStamp Id="sigenclosing-TimeStamp">
> <xad:Include URI="#sigenclosing-Value"/>
> <xad:EncapsulatedTimeStamp>N1vWamMOXstksig=</xad:EncapsulatedTimeStamp>
> </xad:SignatureTimeStamp>
> </xad:UnsignedSignatureProperties>
> </xad:UnsignedProperties>
> </xad:QualifyingProperties>
> </dsig:Object>
> </dsig:Signature>
> </enclosing>
> </first>
> 
> 
> ______________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos
> questions ! Profitez des connaissances, des opinions et des
> expériences des internautes sur Yahoo! Questions/Réponses.
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic