Golang的xml无法解组。

huangapple go评论70阅读模式
英文:

Golang xml doesn't unmarshal

问题

我正在尝试解析以下代码,其中包含底部的Go Playground。data.DocumentType始终返回0,而应该返回内部的xml 4。有人可以告诉我为什么这不起作用吗?

package main

import (
	"encoding/xml"
	"fmt"
)

type doc struct {
	XMLName       xml.Name `xml:"ownershipDocument"`
	SchemaVersion string   `xml:",innerxml"`
	DocumentType  int      `xml:",innerxml"`
}

func main() {
	var Data doc
	xml.Unmarshal([]byte(VV), &Data)
	fmt.Println(Data.DocumentType)
}

const VV = `<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2015-11-18</periodOfReport>

    <issuer>
        <issuerCik>0000820081</issuerCik>
        <issuerName>CAMBREX CORP</issuerName>
        <issuerTradingSymbol>CBM</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001227832</rptOwnerCik>
            <rptOwnerName>KORB WILLIAM B</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>1 MEADOWLANDS PLAZA</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>EAST RUTHERFORD</rptOwnerCity>
            <rptOwnerState>NJ</rptOwnerState>
            <rptOwnerZipCode>07073</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2015-11-18</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>10000</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>50.18</value>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>36562</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value></value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">The price reported in Column 4 is a weighted average price. These shares were sold in multiple transactions at prices ranging from $50.00 to $50.58 inclusive. The reporting person undertakes to provide to Cambrex Corporation, any security holder of Cambrex Corporation, or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in this Footnote 1 to this Form 4.</footnote>
    </footnotes>

    <remarks></remarks>

    <ownerSignature>
        <signatureName>Samantha Hanley for William B. Korb by POA</signatureName>
        <signatureDate>2015-11-20</signatureDate>
    </ownerSignature>
</ownershipDocument>`

链接:http://play.golang.org/p/nJbAF0zKSJ

英文:

Im trying to unmarshal the following code that has the go playground at the bottom. The data.DocumentType always returns 0 and should return the inner xml 4. Can someone tell me why this doesnt work?

package main
import (
&quot;encoding/xml&quot;
&quot;fmt&quot;
)
type doc struct {
XMLName       xml.Name `xml:&quot;ownershipDocument&quot;`
SchemaVersion string   `xml:&quot;,innerxml&quot;`
DocumentType  int      `xml:&quot;,innerxml&quot;`
}
func main() {
var Data doc
xml.Unmarshal([]byte(VV), &amp;Data)
fmt.Println(Data.DocumentType)
}
const VV = `&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;ownershipDocument&gt;
&lt;schemaVersion&gt;X0306&lt;/schemaVersion&gt;
&lt;documentType&gt;4&lt;/documentType&gt;
&lt;periodOfReport&gt;2015-11-18&lt;/periodOfReport&gt;
&lt;issuer&gt;
&lt;issuerCik&gt;0000820081&lt;/issuerCik&gt;
&lt;issuerName&gt;CAMBREX CORP&lt;/issuerName&gt;
&lt;issuerTradingSymbol&gt;CBM&lt;/issuerTradingSymbol&gt;
&lt;/issuer&gt;
&lt;reportingOwner&gt;
&lt;reportingOwnerId&gt;
&lt;rptOwnerCik&gt;0001227832&lt;/rptOwnerCik&gt;
&lt;rptOwnerName&gt;KORB WILLIAM B&lt;/rptOwnerName&gt;
&lt;/reportingOwnerId&gt;
&lt;reportingOwnerAddress&gt;
&lt;rptOwnerStreet1&gt;1 MEADOWLANDS PLAZA&lt;/rptOwnerStreet1&gt;
&lt;rptOwnerStreet2&gt;&lt;/rptOwnerStreet2&gt;
&lt;rptOwnerCity&gt;EAST RUTHERFORD&lt;/rptOwnerCity&gt;
&lt;rptOwnerState&gt;NJ&lt;/rptOwnerState&gt;
&lt;rptOwnerZipCode&gt;07073&lt;/rptOwnerZipCode&gt;
&lt;rptOwnerStateDescription&gt;&lt;/rptOwnerStateDescription&gt;
&lt;/reportingOwnerAddress&gt;
&lt;reportingOwnerRelationship&gt;
&lt;isDirector&gt;1&lt;/isDirector&gt;
&lt;isOfficer&gt;0&lt;/isOfficer&gt;
&lt;isTenPercentOwner&gt;0&lt;/isTenPercentOwner&gt;
&lt;isOther&gt;0&lt;/isOther&gt;
&lt;/reportingOwnerRelationship&gt;
&lt;/reportingOwner&gt;
&lt;nonDerivativeTable&gt;
&lt;nonDerivativeTransaction&gt;
&lt;securityTitle&gt;
&lt;value&gt;Common Stock&lt;/value&gt;
&lt;/securityTitle&gt;
&lt;transactionDate&gt;
&lt;value&gt;2015-11-18&lt;/value&gt;
&lt;/transactionDate&gt;
&lt;transactionCoding&gt;
&lt;transactionFormType&gt;4&lt;/transactionFormType&gt;
&lt;transactionCode&gt;S&lt;/transactionCode&gt;
&lt;equitySwapInvolved&gt;0&lt;/equitySwapInvolved&gt;
&lt;/transactionCoding&gt;
&lt;transactionAmounts&gt;
&lt;transactionShares&gt;
&lt;value&gt;10000&lt;/value&gt;
&lt;/transactionShares&gt;
&lt;transactionPricePerShare&gt;
&lt;value&gt;50.18&lt;/value&gt;
&lt;footnoteId id=&quot;F1&quot;/&gt;
&lt;/transactionPricePerShare&gt;
&lt;transactionAcquiredDisposedCode&gt;
&lt;value&gt;D&lt;/value&gt;
&lt;/transactionAcquiredDisposedCode&gt;
&lt;/transactionAmounts&gt;
&lt;postTransactionAmounts&gt;
&lt;sharesOwnedFollowingTransaction&gt;
&lt;value&gt;36562&lt;/value&gt;
&lt;/sharesOwnedFollowingTransaction&gt;
&lt;/postTransactionAmounts&gt;
&lt;ownershipNature&gt;
&lt;directOrIndirectOwnership&gt;
&lt;value&gt;D&lt;/value&gt;
&lt;/directOrIndirectOwnership&gt;
&lt;natureOfOwnership&gt;
&lt;value&gt;&lt;/value&gt;
&lt;/natureOfOwnership&gt;
&lt;/ownershipNature&gt;
&lt;/nonDerivativeTransaction&gt;
&lt;/nonDerivativeTable&gt;
&lt;footnotes&gt;
&lt;footnote id=&quot;F1&quot;&gt;The price reported in Column 4 is a weighted average price. These shares were sold in multiple transactions at prices ranging from $50.00 to $50.58 inclusive. The reporting person undertakes to provide to Cambrex Corporation, any security holder of Cambrex Corporation, or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in this Footnote 1 to this Form 4.&lt;/footnote&gt;
&lt;/footnotes&gt;
&lt;remarks&gt;&lt;/remarks&gt;
&lt;ownerSignature&gt;
&lt;signatureName&gt;Samantha Hanley for William B. Korb by POA&lt;/signatureName&gt;
&lt;signatureDate&gt;2015-11-20&lt;/signatureDate&gt;
&lt;/ownerSignature&gt;
&lt;/ownershipDocument&gt;`

http://play.golang.org/p/nJbAF0zKSJ

答案1

得分: 1

移除DocumentType上的innerxml标签,并将其命名为要匹配的元素名称(xml:"documentType")。根据xml库文档

如果结构体具有类型为[]bytestring的字段,并带有标签",innerxml",Unmarshal会将该字段中的嵌套元素的原始XML累积起来。其余规则仍然适用。

您不需要存储未处理的XML。您只需要获取字段的值,因此不需要该标签。

工作版本

*编辑:实际上,",innerxml"标签也会破坏SchemaVersion字段,因为它没有匹配的元素(而且由于SchemaVersion是一个字符串),它会存储整个文档。

英文:

Remove the innerxml tag on DocumentType, and give it the name of the element to to match (xml:&quot;documentType&quot;). From the xml library docs:

>If the struct has a field of type []byte or string with tag ",innerxml", Unmarshal accumulates the raw XML nested inside the element in that field. The rest of the rules still apply.

You don't need to store unprocessed XML. You're looking for the value of the field, so you don't need the tag.

Working version

*edit: For that matter, the &quot;,innerxml&quot; tag will also break the SchemaVersion field as well&mdash;without a matching element (and since SchemaVersion is a string), it stores the whole document.

答案2

得分: 0

我尽力而为,请提供建议和帮助。我使用了这种方法,请评论并提出建议。

package main

import (
	"fmt"
	"encoding/xml"
)

func main(){
	dxml := `
	<?xml version="1.0"?>
	<ownershipDocument>
		<schemaVersion>X0306</schemaVersion>
		<documentType>4</documentType>
		<periodOfReport>2015-11-18</periodOfReport>
		<issuer>
			<issuerCik>0000820081</issuerCik>
			<issuerName>CAMBREX CORP</issuerName>
			<issuerTradingSymbol>CBM</issuerTradingSymbol>
		</issuer>
		<reportingOwner>
			<reportingOwnerId>
				<rptOwnerCik>0001227832</rptOwnerCik>
				<rptOwnerName>KORB WILLIAM B</rptOwnerName>
			</reportingOwnerId>
			<reportingOwnerAddress>
				<rptOwnerStreet1>1 MEADOWLANDS PLAZA</rptOwnerStreet1>
				<rptOwnerStreet2/>
				<rptOwnerCity>EAST RUTHERFORD</rptOwnerCity>
				<rptOwnerState>NJ</rptOwnerState>
				<rptOwnerZipCode>07073</rptOwnerZipCode>
				<rptOwnerStateDescription/>
			</reportingOwnerAddress>
			<reportingOwnerRelationship>
				<isDirector>1</isDirector>
				<isOfficer>0</isOfficer>
				<isTenPercentOwner>0</isTenPercentOwner>
				<isOther>0</isOther>
			</reportingOwnerRelationship>
		</reportingOwner>
		<nonDerivativeTable>
			<nonDerivativeTransaction>
				<securityTitle>
					<value>Common Stock</value>
				</securityTitle>
				<transactionDate>
					<value>2015-11-18</value>
				</transactionDate>
				<transactionCoding>
					<transactionFormType>4</transactionFormType>
					<transactionCode>S</transactionCode>
					<equitySwapInvolved>0</equitySwapInvolved>
				</transactionCoding>
				<transactionAmounts>
					<transactionShares>
						<value>10000</value>
					</transactionShares>
					<transactionPricePerShare>
						<value>50.18</value>
						<footnoteId id="F1"/>
					</transactionPricePerShare>
					<transactionAcquiredDisposedCode>
						<value>D</value>
					</transactionAcquiredDisposedCode>
				</transactionAmounts>
				<postTransactionAmounts>
					<sharesOwnedFollowingTransaction>
						<value>36562</value>
					</sharesOwnedFollowingTransaction>
				</postTransactionAmounts>
				<ownershipNature>
					<directOrIndirectOwnership>
						<value>D</value>
					</directOrIndirectOwnership>
					<natureOfOwnership>
						<value/>
					</natureOfOwnership>
				</ownershipNature>
			</nonDerivativeTransaction>
		</nonDerivativeTable>
		<footnotes>
			<footnote id="F1">The price reported in Column 4 is a weighted average price. These shares were sold in multiple transactions at prices ranging from $50.00 to $50.58 inclusive. The reporting person undertakes to provide to Cambrex Corporation, any security holder of Cambrex Corporation, or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in this Footnote 1 to this Form 4.</footnote>
		</footnotes>
		<remarks/>
		<ownerSignature>
			<signatureName>Samantha Hanley for William B. Korb by POA</signatureName>
			<signatureDate>2015-11-20</signatureDate>
		</ownerSignature>
	</ownershipDocument>
	`

	defer func() {
		if errD := recover(); errD != nil {
			fmt.Println("!!!!!!!!!!!!!!!!Panic Occured and Recovered in func main(), Error Info: ", errD)
		}
	}()

	var Owner Ownershipdocs

	err := xml.Unmarshal([]byte(dxml), &Owner)
	fmt.Println("xml.unmarshal error info :", err)
	fmt.Println("SchemaVersion : ", Owner.SchemaVersion)
	fmt.Println("DocumentType : ", Owner.DocumentType)
	fmt.Println("PeriodOfReport : ", Owner.PeriodOfReport)
	fmt.Println("IssuerCik : ", Owner.IssuerCik)
	fmt.Println("IssuerName : ", Owner.IssuerName)
	fmt.Println("IssuerTradingSymbol : ", Owner.IssuerTradingSymbol)
	fmt.Println("RptOwnerCik : ", Owner.RptOwnerCik)
	fmt.Println("RptOwnerName : ", Owner.RptOwnerName)
	fmt.Println("RptOwnerStreet1 : ", Owner.RptOwnerStreet1)
	fmt.Println("RptOwnerCity :  ", Owner.RptOwnerCity)
	fmt.Println("RptOwnerState : ", Owner.RptOwnerState)
	fmt.Println("RptOwnerZipCode : ", Owner.RptOwnerZipCode)
	fmt.Println("IsDirector : ", Owner.IsDirector)
	fmt.Println("IsOfficer :  ", Owner.IsOfficer)
	fmt.Println("IsTenPercentOwner : ", Owner.IsTenPercentOwner)
	fmt.Println("IsOther : ", Owner.IsOther)
	fmt.Println("SecurityTitleValue : ", Owner.SecurityTitleValue)
	fmt.Println("TransactionDatevalue : ", Owner.TransactionDatevalue)
	fmt.Println("TransactionFormType : ", Owner.TransactionFormType)
	fmt.Println("TransactionCode : ", Owner.TransactionCode)
	fmt.Println("EquitySwapInvolved : ", Owner.EquitySwapInvolved)
	fmt.Println("TransactionSharesValue : ", Owner.TransactionSharesValue)
	fmt.Println("TransactionPricePerShareValue : ", Owner.TransactionPricePerShareValue)
	fmt.Println("TransactionPricePerSharefootnoteId :  ", Owner.TransactionPricePerSharefootnoteId)
	fmt.Println("TransactionAcquiredDisposedCodeValue : ", Owner.TransactionAcquiredDisposedCodeValue)
	fmt.Println("Footnote.Footnote : ", Owner.Footnote.Footnote)
	fmt.Println("OwnerSignaturesignatureName : ", Owner.OwnerSignaturesignatureName)
	fmt.Println("OwnerSignaturesignatureDate : ", Owner.OwnerSignaturesignatureDate)
}

type Ownershipdocs struct{
	SchemaVersion  			string `xml:"schemaVersion"`
	DocumentType   			string `xml:"documentType"`
	PeriodOfReport 			string `xml:"periodOfReport"`
	IssuerCik				string `xml:"issuer>issuerCik"`
	IssuerName				string `xml:"issuer>issuerName"`
	IssuerTradingSymbol		string `xml:"issuer>issuerTradingSymbol"`
	RptOwnerCik				string `xml:"reportingOwner>reportingOwnerId>rptOwnerCik"`
	RptOwnerName			string `xml:"reportingOwner>reportingOwnerId>rptOwnerName"`
	RptOwnerStreet1			string `xml:"reportingOwner>reportingOwnerAddress>rptOwnerStreet1"`
	RptOwnerCity			string `xml:"reportingOwner>reportingOwnerAddress>rptOwnerCity"`
	RptOwnerState			string `xml:"reportingOwner>reportingOwnerAddress>rptOwnerState"`
	RptOwnerZipCode			string `xml:"reportingOwner>reportingOwnerAddress>rptOwnerZipCode"`
	IsDirector				string `xml:"reportingOwner>reportingOwnerRelationship>isDirector"`
	IsOfficer				string `xml:"reportingOwner>reportingOwnerRelationship>isOfficer"`
	IsTenPercentOwner		string `xml:"reportingOwner>reportingOwnerRelationship>isTenPercentOwner"`
	IsOther					string `xml:"reportingOwner>reportingOwnerRelationship>isOther"`
	SecurityTitleValue		string `xml:"nonDerivativeTable>nonDerivativeTransaction>securityTitle>value"`
	TransactionDatevalue	string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionDate>value"`
	TransactionFormType		string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionCoding>transactionFormType"`
	TransactionCode			string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionCoding>transactionCode"`
	EquitySwapInvolved		string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionCoding>equitySwapInvolved"`
	TransactionSharesValue					string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionAmounts>transactionShares>value"`
	TransactionPricePerShareValue			string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionAmounts>transactionPricePerShare>value"`
	TransactionPricePerSharefootnoteId 		string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionAmounts>transactionPricePerShare>footnoteId"`
	TransactionAcquiredDisposedCodeValue	string `xml:"nonDerivativeTable>nonDerivativeTransaction>transactionAmounts>transactionAcquiredDisposedCode>value"`
	SharesOwnedFollowingTransactionValue	string `xml:"nonDerivativeTable>nonDerivativeTransaction>ownershipNature>directOrIndirectOwnership>value"`
	Footnote 				   				Footnotes 	`xml:"footnotes"`
	OwnerSignaturesignatureName 			string       `xml:"ownerSignature>signatureName"`
	OwnerSignaturesignatureDate				string       `xml:"ownerSignature>signatureDate"`
}

type Footnotes struct{
	ID	 		string `xml:"id,attr"`
	Footnote 	string `xml:"footnote"`
}
英文:
I tried to do as much i could please suggest and help . 
I use this method please comment and suggest.  
https://play.golang.org/p/kb0HF8ykHW
package main;
import (
&quot;fmt&quot;
&quot;encoding/xml&quot;	
)
func main(){
dxml := `
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;ownershipDocument&gt;
&lt;schemaVersion&gt;X0306&lt;/schemaVersion&gt;
&lt;documentType&gt;4&lt;/documentType&gt;
&lt;periodOfReport&gt;2015-11-18&lt;/periodOfReport&gt;
&lt;issuer&gt;
&lt;issuerCik&gt;0000820081&lt;/issuerCik&gt;
&lt;issuerName&gt;CAMBREX CORP&lt;/issuerName&gt;
&lt;issuerTradingSymbol&gt;CBM&lt;/issuerTradingSymbol&gt;
&lt;/issuer&gt;
&lt;reportingOwner&gt;
&lt;reportingOwnerId&gt;
&lt;rptOwnerCik&gt;0001227832&lt;/rptOwnerCik&gt;
&lt;rptOwnerName&gt;KORB WILLIAM B&lt;/rptOwnerName&gt;
&lt;/reportingOwnerId&gt;
&lt;reportingOwnerAddress&gt;
&lt;rptOwnerStreet1&gt;1 MEADOWLANDS PLAZA&lt;/rptOwnerStreet1&gt;
&lt;rptOwnerStreet2/&gt;
&lt;rptOwnerCity&gt;EAST RUTHERFORD&lt;/rptOwnerCity&gt;
&lt;rptOwnerState&gt;NJ&lt;/rptOwnerState&gt;
&lt;rptOwnerZipCode&gt;07073&lt;/rptOwnerZipCode&gt;
&lt;rptOwnerStateDescription/&gt;
&lt;/reportingOwnerAddress&gt;
&lt;reportingOwnerRelationship&gt;
&lt;isDirector&gt;1&lt;/isDirector&gt;
&lt;isOfficer&gt;0&lt;/isOfficer&gt;
&lt;isTenPercentOwner&gt;0&lt;/isTenPercentOwner&gt;
&lt;isOther&gt;0&lt;/isOther&gt;
&lt;/reportingOwnerRelationship&gt;
&lt;/reportingOwner&gt;
&lt;nonDerivativeTable&gt;
&lt;nonDerivativeTransaction&gt;
&lt;securityTitle&gt;
&lt;value&gt;Common Stock&lt;/value&gt;
&lt;/securityTitle&gt;
&lt;transactionDate&gt;
&lt;value&gt;2015-11-18&lt;/value&gt;
&lt;/transactionDate&gt;
&lt;transactionCoding&gt;
&lt;transactionFormType&gt;4&lt;/transactionFormType&gt;
&lt;transactionCode&gt;S&lt;/transactionCode&gt;
&lt;equitySwapInvolved&gt;0&lt;/equitySwapInvolved&gt;
&lt;/transactionCoding&gt;
&lt;transactionAmounts&gt;
&lt;transactionShares&gt;
&lt;value&gt;10000&lt;/value&gt;
&lt;/transactionShares&gt;
&lt;transactionPricePerShare&gt;
&lt;value&gt;50.18&lt;/value&gt;
&lt;footnoteId id=&quot;F1&quot;/&gt;
&lt;/transactionPricePerShare&gt;
&lt;transactionAcquiredDisposedCode&gt;
&lt;value&gt;D&lt;/value&gt;
&lt;/transactionAcquiredDisposedCode&gt;
&lt;/transactionAmounts&gt;
&lt;postTransactionAmounts&gt;
&lt;sharesOwnedFollowingTransaction&gt;
&lt;value&gt;36562&lt;/value&gt;
&lt;/sharesOwnedFollowingTransaction&gt;
&lt;/postTransactionAmounts&gt;
&lt;ownershipNature&gt;
&lt;directOrIndirectOwnership&gt;
&lt;value&gt;D&lt;/value&gt;
&lt;/directOrIndirectOwnership&gt;
&lt;natureOfOwnership&gt;
&lt;value/&gt;
&lt;/natureOfOwnership&gt;
&lt;/ownershipNature&gt;
&lt;/nonDerivativeTransaction&gt;
&lt;/nonDerivativeTable&gt;
&lt;footnotes&gt;
&lt;footnote id=&quot;F1&quot;&gt;The price reported in Column 4 is a weighted average price. These shares were sold in multiple transactions at prices ranging from $50.00 to $50.58 inclusive. The reporting person undertakes to provide to Cambrex Corporation, any security holder of Cambrex Corporation, or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in this Footnote 1 to this Form 4.&lt;/footnote&gt;
&lt;/footnotes&gt;
&lt;remarks/&gt;
&lt;ownerSignature&gt;
&lt;signatureName&gt;Samantha Hanley for William B. Korb by POA&lt;/signatureName&gt;
&lt;signatureDate&gt;2015-11-20&lt;/signatureDate&gt;
&lt;/ownerSignature&gt;
&lt;/ownershipDocument&gt;
`
defer func() {
if errD := recover(); errD != nil {
fmt.Println(&quot;!!!!!!!!!!!!!!!!Panic Occured and Recovered in func main(), Error Info: &quot;, errD)
}
}()
var Owner Ownershipdocs 
err := xml.Unmarshal([]byte(dxml), &amp;Owner)
fmt.Println(&quot;xml.unmarshal error info :&quot;,err)
fmt.Println(&quot;SchemaVersion : &quot;,Owner.SchemaVersion)
fmt.Println(&quot;DocumentType : &quot;,Owner.DocumentType)
fmt.Println(&quot;PeriodOfReport : &quot;,Owner.PeriodOfReport)
fmt.Println(&quot;IssuerCik : &quot;,Owner.IssuerCik)
fmt.Println(&quot;IssuerName : &quot;,Owner.IssuerName)
fmt.Println(&quot;IssuerTradingSymbol : &quot;,Owner.IssuerTradingSymbol)
fmt.Println(&quot;RptOwnerCik : &quot;,Owner.RptOwnerCik)
fmt.Println(&quot;RptOwnerName : &quot;,Owner.RptOwnerName)
fmt.Println(&quot;RptOwnerStreet1 : &quot;,Owner.RptOwnerStreet1)
fmt.Println(&quot;RptOwnerCity :  &quot;,Owner.RptOwnerCity)
fmt.Println(&quot;RptOwnerState : &quot;,Owner.RptOwnerState)
fmt.Println(&quot;RptOwnerZipCode : &quot;,Owner.RptOwnerZipCode)
fmt.Println(&quot;IsDirector	: &quot;,Owner.IsDirector)	
fmt.Println(&quot;IsOfficer :  &quot;,Owner.IsOfficer)
fmt.Println(&quot;IsTenPercentOwner : &quot;,Owner.IsTenPercentOwner)
fmt.Println(&quot;IsOther : &quot;,Owner.IsOther)
fmt.Println(&quot;SecurityTitleValue : &quot;,Owner.SecurityTitleValue)
fmt.Println(&quot;TransactionDatevalue : &quot;,Owner.TransactionDatevalue)
fmt.Println(&quot;TransactionFormType : &quot;,Owner.TransactionFormType)
fmt.Println(&quot;TransactionCode : &quot;,Owner.TransactionCode)
fmt.Println(&quot;EquitySwapInvolved : &quot;,Owner.EquitySwapInvolved)
fmt.Println(&quot;TransactionSharesValue : &quot;,Owner.TransactionSharesValue)
fmt.Println(&quot;TransactionPricePerShareValue : &quot;,Owner.TransactionPricePerShareValue)
fmt.Println(&quot;TransactionPricePerSharefootnoteId :  &quot;,Owner.TransactionPricePerSharefootnoteId)
fmt.Println(&quot;TransactionAcquiredDisposedCodeValue : &quot;,Owner.TransactionAcquiredDisposedCodeValue)
fmt.Println(&quot;Footnote.Footnote : &quot;,Owner.Footnote.Footnote)
fmt.Println(&quot;OwnerSignaturesignatureName : &quot;,Owner.OwnerSignaturesignatureName)
fmt.Println(&quot;OwnerSignaturesignatureDate	: &quot;,Owner.OwnerSignaturesignatureDate)	
}
type Ownershipdocs struct{
SchemaVersion  			string `xml:&quot;schemaVersion&quot;`
DocumentType   			string `xml:&quot;documentType&quot;`
PeriodOfReport 			string `xml:&quot;periodOfReport&quot;`
IssuerCik				string `xml:&quot;issuer&gt;issuerCik&quot;`
IssuerName				string `xml:&quot;issuer&gt;issuerName&quot;`
IssuerTradingSymbol		string `xml:&quot;issuer&gt;issuerTradingSymbol&quot;`
RptOwnerCik				string `xml:&quot;reportingOwner&gt;reportingOwnerId&gt;rptOwnerCik&quot;`
RptOwnerName			string `xml:&quot;reportingOwner&gt;reportingOwnerId&gt;rptOwnerName&quot;`
RptOwnerStreet1			string `xml:&quot;reportingOwner&gt;reportingOwnerAddress&gt;rptOwnerStreet1&quot;`
RptOwnerCity			string `xml:&quot;reportingOwner&gt;reportingOwnerAddress&gt;rptOwnerCity&quot;`
RptOwnerState			string `xml:&quot;reportingOwner&gt;reportingOwnerAddress&gt;rptOwnerState&quot;`
RptOwnerZipCode			string `xml:&quot;reportingOwner&gt;reportingOwnerAddress&gt;rptOwnerZipCode&quot;`
IsDirector				string `xml:&quot;reportingOwner&gt;reportingOwnerRelationship&gt;isDirector&quot;`
IsOfficer				string `xml:&quot;reportingOwner&gt;reportingOwnerRelationship&gt;isOfficer&quot;`	
IsTenPercentOwner		string `xml:&quot;reportingOwner&gt;reportingOwnerRelationship&gt;isTenPercentOwner&quot;`
IsOther					string `xml:&quot;reportingOwner&gt;reportingOwnerRelationship&gt;isOther&quot;`		
SecurityTitleValue		string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;securityTitle&gt;value&quot;`
TransactionDatevalue	string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionDate&gt;value&quot;`	
TransactionFormType		string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionCoding&gt;transactionFormType&quot;`
TransactionCode			string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionCoding&gt;transactionCode&quot;`
EquitySwapInvolved		string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionCoding&gt;equitySwapInvolved&quot;`
TransactionSharesValue					string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionAmounts&gt;transactionShares&gt;value&quot;`
TransactionPricePerShareValue			string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionAmounts&gt;transactionPricePerShare&gt;value&quot;`
TransactionPricePerSharefootnoteId 		string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionAmounts&gt;transactionPricePerShare&gt;footnoteId&quot;`
TransactionAcquiredDisposedCodeValue	string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;transactionAmounts&gt;transactionAcquiredDisposedCode&gt;value&quot;`
SharesOwnedFollowingTransactionValue	string `xml:&quot;nonDerivativeTable&gt;nonDerivativeTransaction&gt;ownershipNature&gt;directOrIndirectOwnership&gt;value&quot;`
Footnote 				   				Footnotes 	`xml:&quot;footnotes&quot;`
OwnerSignaturesignatureName 			string       `xml:&quot;ownerSignature&gt;signatureName&quot;`
OwnerSignaturesignatureDate				string       `xml:&quot;ownerSignature&gt;signatureDate&quot;`
}
type Footnotes struct{
ID	 		string `xml:&quot;id,attr&quot;`
Footnote 	string `xml:&quot;footnote&quot;`
}

huangapple
  • 本文由 发表于 2015年11月21日 12:03:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/33839577.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定