Re: [Servingxml-help] header content
Brought to you by:
danielaparker
|
From: Daniel P. <dan...@sy...> - 2007-04-06 03:09:08
|
Ravi,
Thanks for the feedback, I think you're right. Expect to see this in =
the next release, but you can have this now, by making a small change to =
the ElementMap, FieldElementMap, and GenerateElement java files, all in =
the com.servingxml.components.recordmapping package. In the =
startContent method, remove the check "if value.length() > 0":
//if (value.length() > 0) {
Name name =3D mappedAttribute.createName(record);
String attQName =3D name.toQName(context);
=
atts.addAttribute(name.getNamespaceUri(),name.getLocalName(),
attQName,"CDATA",value);
//}
-- Daniel
----- Original Message -----=20
From: Ravikumar Tadysetty=20
To: Daniel Parker=20
Sent: Thursday, April 05, 2007 6:38 PM
Subject: Re: [Servingxml-help] header content
Thanks for the solution. That is exactly what I wanted.
One more question:
In the below record mapping, if reference is blank, then the attribute =
on transaction element is removed. Instead I am expecting it to remain =
with an empty value. Is there a way to retain the attribute even if the =
value is blank, just as we do for elements.=20
And then, may be we can remove them using something like =
sx:removeEmptyAttributeFilter.
expected : <transaction reference=3D"">
actual : <transaction>
<transaction>
<sx:fieldAttributeMap field=3D"id" attribute=3D"id"/>
<sx:fieldAttributeMap field=3D"reference" =
attribute=3D"reference"/>=20
<sx:fieldElementMap field=3D"description" =
element=3D"description"/>
</transaction>
On 4/4/07, Daniel Parker <dan...@sy...> wrote:=20
Currently, you only have one option to examine the values of =
specific fields in the header or trailer records as they are read. That =
is to use a sx:flatFileSignature element, with recordType=3D<record type =
name of a header or trailer record>, field=3D<field name in the header =
or trailer record>, custom=3D"yes", class=3D<implementation of =
com.servingxml.components.recordio.flatfile.SignatureMethod >, and =
validate=3D"yes".
Your implementation would look like
public class MySignatureMethod implements SignatureMethod {
private Value expectedValue;
public void data(byte[] bytes, int start, int length)
throws ServingXmlException {
// Do nothing
}
public void validate(Value expectedValue) throws =
ServingXmlException {
this.expectedValue =3D expectedValue;
// This is the value for the header/trailer field. Your only =
real option at this
// point is to throw an exception if you don't like it
}
public Value getSignature() {
return expectedValue;
}
}
Check the element reference on sx:flatFileSignature, and the =
javadocs for SignatureMethod.
-- Daniel
----- Original Message -----=20
From: Ravikumar Tadysetty=20
To: Daniel Parker=20
Sent: Wednesday, April 04, 2007 3:12 PM
Subject: [Servingxml-help] header content
Hi
I am using sx:flatfileheader to indicate a header record of a flat =
file. How can I examine the contents of this record in Java code. via =
RecordFilter or some other means.
Thanks
Ravi
-------------------------------------------------------------------------=
-
=
-------------------------------------------------------------------------=
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to =
share your
opinions on IT & business topics through brief surveys-and earn =
cash
=
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D=
DEVDEV=20
-------------------------------------------------------------------------=
-
_______________________________________________
Servingxml-help mailing list
Ser...@li...
https://lists.sourceforge.net/lists/listinfo/servingxml-help
|