Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79140
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'skip:e 50': 0.05; 'tree': 0.05; 'skip:" 60': 0.07; 'fix.': 0.09; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:o 60': 0.09; 'try:': 0.09; 'subject:Help': 0.11; 'finds': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'skip:t 90': 0.16; 'skip:w 70': 0.16; 'subject:issue': 0.16; 'skip:= 10': 0.16; 'wrote:': 0.18; 'import': 0.22; 'header:User- Agent:1': 0.23; 'task': 0.26; 'code:': 0.26; 'header:X-Complaints- To:1': 0.27; 'correct': 0.29; 'feature': 0.29; 'xml': 0.29; 'code': 0.31; 'fault': 0.31; 'file:': 0.31; 'skip:= 20': 0.31; 'could': 0.34; 'except': 0.35; 'offered': 0.35; 'something': 0.35; 'but': 0.35; 'false': 0.36; 'url:org': 0.36; 'list': 0.37; 'expected': 0.38; 'to:addr:python-list': 0.38; 'url:schemas': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:x 10': 0.40; 'direct': 0.67; 'truck': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: Jython or Pyton issue-- Kindly Help me.... |
| Date | Wed, 15 Oct 2014 09:32:37 +0200 |
| Organization | None |
| References | <91eb3378-958d-45e0-8741-a800ae681260@googlegroups.com> <mailman.14825.1413215053.18130.python-list@python.org> <552277f6-fb5b-44de-a0d4-7c7fe480d265@googlegroups.com> <mailman.14843.1413283448.18130.python-list@python.org> <0c8200cc-5ae7-4fd9-9dd6-903802fc5bb7@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p57bd904a.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14875.1413358370.18130.python-list@python.org> (permalink) |
| Lines | 127 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413358370 news.xs4all.nl 2940 [2001:888:2000:d::a6]:48030 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79140 |
Show key headers only | View raw
Venugopal Reddy wrote:
> Actuvally am having below XML File:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body>
> <c:RetriveByVehicleLineModelYearResponse
> xmlns:a="urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0"
> xmlns:b="urn:ford/VehicleOrder/SingleOrderEdit/v1.0"
> xmlns:c="urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2">
> <c:PortInstalledOptionFeature> <a:VehicleLineId>13001</a:VehicleLineId>
> <a:ModelYear>2014</a:ModelYear> <a:LegacyColumn>12</a:LegacyColumn>
> <a:LegacyValue>178 </a:LegacyValue>
> <a:SalesCode>W78</a:SalesCode>
> <a:MappingId>41859</a:MappingId>
> <a:MappingSeq>0</a:MappingSeq>
> <a:MappingDirection>B</a:MappingDirection>
> <a:TargetFeature>
> <a:TargetCatgegory>
> <a:Id>181</a:Id>
> <a:Name>LIGHT TRUCK WHEELBASES </a:Name>
> <a:Type>P</a:Type>
> <a:FamilyCode>AA5</a:FamilyCode>
> </a:TargetCatgegory>
> <a:OrderFeatureId>15615</a:OrderFeatureId>
> <a:WersCode>AA5K8</a:WersCode>
> <a:OrderFeatureName>178 /4521MM WHEELBASE </a:OrderFeatureName>
> <a:PIO>false</a:PIO>
> <a:SummaryFeature>false</a:SummaryFeature>
> </a:TargetFeature>
> <a:TargetFeature>
> <a:TargetCatgegory>
> <a:Id>181</a:Id>
> <a:Name>LIGHT TRUCK WHEELBASES </a:Name>
> <a:Type>P</a:Type>
> <a:FamilyCode>AA5</a:FamilyCode>
> </a:TargetCatgegory>
> <a:OrderFeatureId>15615</a:OrderFeatureId>
> <a:WersCode>AA5K8_second time</a:WersCode>
> <a:OrderFeatureName>178 /4521MM WHEELBASE </a:OrderFeatureName>
> <a:PIO>false</a:PIO>
> <a:SummaryFeature>false</a:SummaryFeature>
> </a:TargetFeature>
> </c:PortInstalledOptionFeature>
> <c:PortInstalledOptionFeature>
> <a:VehicleLineId>13001</a:VehicleLineId>
> <a:ModelYear>2014</a:ModelYear>
> <a:LegacyColumn>12</a:LegacyColumn>
> <a:LegacyValue>190 </a:LegacyValue>
> <a:SalesCode>W90</a:SalesCode>
> <a:MappingId>41860</a:MappingId>
> <a:MappingSeq>0</a:MappingSeq>
> <a:MappingDirection>B</a:MappingDirection>
> <a:TargetFeature>
> <a:TargetCatgegory>
> <a:Id>181</a:Id>
> <a:Name>LIGHT TRUCK WHEELBASES </a:Name>
> <a:Type>P</a:Type>
> <a:FamilyCode>AA5</a:FamilyCode>
> </a:TargetCatgegory>
> <a:OrderFeatureId>15616</a:OrderFeatureId>
> <a:WersCode>AA5MA</a:WersCode>
> <a:OrderFeatureName>190 /4826MM WHEELBASE </a:OrderFeatureName>
> <a:PIO>false</a:PIO>
> <a:SummaryFeature>false</a:SummaryFeature>
> </a:TargetFeature>
> </c:PortInstalledOptionFeature>
> </c:RetriveByVehicleLineModelYearResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> ============================
>
> My expected Output is:
>
>
> WersCode
> AA5K8
> AA5MA
>
> ============== For this I have used below Code:
>
> mport glob
> import xml.etree.ElementTree as ET
>
> Fatfile = open('#Var_SOE_VLIS_Response_Output\\Sales_to_Wers_Code2.txt',
> 'a') try:
> tree = ET.parse('#Var_ENG_Response_Files\\SoapResponse1.xml')
> Fatfile.write('1111')
> WersCodeList =
>
tree.findall('./{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}PortInstalledOptionFeature')
> Fatfile.write('\n2222')
> # x = len(WersCodeList)
> # Fatfile.write(x)
> Fatfile.write('\n333')
> for WersCode in WersCodeList :
> Fatfile.write('\n444')
> WersCode =
>
WersCode.find('.//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode')
> Fatfile.write('\n') Fatfile.write(WersCode.text)
> except :
> Fatfile.write(' \nsorry')
> Fatfile.write(' \nSuccess')
>
> ====
>
> But I could not able to get the WersCode List using Findall.
- The namespace is not correct
- "./" finds only direct children
Try something like
for feature in tree.findall(
".//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature"):
code = feature.find(
".//{urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0}WersCode")
print(code.text)
> Please please please help on this .. am struggling sice one week sir...
... and it's all your fault because you offered a task to do for you instead
of some code we could help you fix.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-13 04:39 -0700
Re: Jython or Pyton issue-- Kindly Help me.... Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-13 09:43 -0600
Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-14 02:46 -0700
Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-14 12:43 +0200
Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-14 22:42 -0700
Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-15 09:32 +0200
Re: Jython or Pyton issue-- Kindly Help me.... Venugopal Reddy <venugopal.reddy@tspl.com> - 2014-10-15 01:35 -0700
Re: Jython or Pyton issue-- Kindly Help me.... Peter Otten <__peter__@web.de> - 2014-10-15 11:04 +0200
csiph-web